Programming Spike Prime Cylindrical robot - Step by step

1. Install and open the Spike App.

2. Select to work with Spike Prime set.

Diagram

Description automatically generated

3. Close splash window and select NEW PROJECT on next screen.

Graphical user interface, application, Word

Description automatically generated 

4. Create new WORD BLOCKS project and name it Polar-robot.

5. Connect your Spike Prime Hub to the computer with USB micro cable and turn on the Hub by long pressing the middle button. You will be notified that Hub is connected and Hub icon is displayed with green checkmark in upper left corner of the screen. Also note that all 3 motor positions are visible there.

6. From the block palette select VARIABLES and click on Make a Variable. Name it speed.

 

9. Repeat this and make 3 more variables: B, H, V. They will be used for displaying the motor positions.

10. Set the speed variable value to 10 and use it to set movement speed for all motors. 

11. From the block palette choose MY BLOCKS and click on Make a Block button to create a new block. Name it move.

12. Click on Add an input icon 3 times to add 3 input parameters. 

13. Name the parameters B, V, H and click on SAVE to save it.

14. Before defining the move block with B, V, H parameters, let’s analyse the movement.

  • B - is the input value for Motor A (Ma) - rotates the upper part of the robot arm
    - clockwise (+)
    - counter clockwise (-)
    from -0.25 to 0.25 rotations (-90 to 90 degrees).

  • V - is the input value for Motor C (Mc) - rotates the horizontal support clockwise or counter clockwise:
    - clockwise (+), the support rotates up
    - counter clockwise (-), support rotates down
    from - 0.2 to 0.2 rotation.  

  • H - is the input value for Motor B (Mb) - moves the effector horizontally:
    - forward (+), motor rotates counter clockwise
    - backward (-), motor rotates clockwise
    from 0 to 1 rotation.   


15. First step is to handle the input parameters B, H, V and transfer it to the corresponding motors.  

16. Stop the movement and transfer the change of the position to corresponding variables. 

17. In the main part of the program reset the values of B, H and V variables to 0.

18. Add the move blocks and stop the program at the end

19. Connect your Spike Prime Hub to the computer with USB micro cable and turn on the Hub by pressing the middle button long. You will be notified that Hub is connected and Hub icon is displayed with green checkmark in upper left corner of the screen. Also note that all 3 motor positions are visible there. Press PLAY button (yellow) in lower right corner and try the code. 

Open variable panel (right) to monitor the motor positions B- Motor A (Ma), V - Motor C (Mc), H - Motor B (Mb).