Skip to content

Instantly share code, notes, and snippets.

@topshed
Last active April 15, 2024 15:12
Show Gist options
  • Save topshed/dcb866993f384530e807fb5c253e0863 to your computer and use it in GitHub Desktop.
Save topshed/dcb866993f384530e807fb5c253e0863 to your computer and use it in GitHub Desktop.
LEGO Spike Prime snippets for CoderDojo
Making a robot move
@topshed
Copy link
Author

topshed commented Jan 11, 2024

Moving your robot

Move forward for 2 seconds, then stop:

move_stop

This method uses the blocks that are intended for 2 wheeled robots. Movement will start as soon as the program is run.

To move forward then turn right, then carry on, then stop:

This time the movement will not start until the left button on the top of the hub is pressed (this is useful for testing).

turn_right_rot

Another way to move forward then turn right, then carry on, then stop:

This method controls each motor separately.

move_2png

Another way to move forward then turn right, then carry on, then stop:

turn _right_2

NEXT: Detecting obstacles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment