Goal: To add a new block for the forward movement of the Electric Ray robot.
Step 1: Write the code for forward movement in Arduino IDE, port it to Electric Ray and test if it is working.
Code for forward movement is show below.
This whole code is rewritten for Minibloq as below. Be careful with the minor changes in the syntax.
main.board is updated with the above code inside the <initCode></initCode> section.
Step 2: Create a .rel file in the rel folder with the naming convention explained in the previous section.
Step 3: Create a new folder under \source\Bin\Minibloq\blocks having the same name as .rel file. The folder will have
(1) main.block file - this xml contains all the properties of the block
(2) images - this folder contains all the icons needed for the block - Default, Disabled, Hover, Pressed icons for the block.
Step 4: Design all the icons and keep it images folder.
Step 5: Edit the main.block file to set the new functions and icons.
Function call is specified in <code> section of the main.block.
Update the icon names in the <picker> and <blockButton> sections.
Update the parameters in the <params> section
Open Minibloq. A new block for forward will be added to the action window. Program using the new block and test if the outputs are correct.