Skip to content

Instantly share code, notes, and snippets.

View JohanS-bricks's full-sized avatar

JohanS-bricks

View GitHub Profile
@JohanS-bricks
JohanS-bricks / snake.md
Last active May 13, 2021 17:10
Instructions on how to code a Mindstorms 51515 Snake robot in Python

Mindstorms 51515 Snake Python program

In the video https://youtu.be/BaeoT4V_PN4 the Mindstorms 51515 snake is programmed in Python. There is a video on how to program the snake with Word Blocks (Scratch programming language) https://youtu.be/qKI21klIH5U which also adds remote control, but the motion loop is not super-tight.

To get the tightest possible movement one need to program it in Python, in this case we have to give up the remote control so the snake will just move forward but will do so in greater style! There is also the potential to utilize the distance sensor to make a wall-avoiding snake for those who want to take it a step further. Programming in Python requires quite a few lines of code to be written. Luckily Anton from Antons Mindstorms Hacks (https://antonsmindstorms.com/) has provided a library that makes all the heavy lifting and allows for very easy animation of the robots.

Prerequisites

  1. Read the article at https://antonsmindstorms.com/2021/02/20/keyframe-motor-animation-with-