TurtlePi code

As promised several times, here’s the python code for my turtle command line interface (turtlecli) and turtle server (turtlesvr). I’ve saved them as text files so your OS won’t moan so you’ll need to rename them as .py or no suffix and “chmod +x” them.

To run the turtle code, just type “sudo ./turtlesvr”.  The Turtle serve code just sits passively on the turtle waiting for a command from the CLI.

The turtle command line interface (CLI) runs on another Pi, and accepts type commands, which it passes to the Turtle to enact.  Here’s a few syntax examples:

  • move fwd 100
  • move bck 38
  • turn cw 189
  • sweep acw 97
Simples!
P.S. This is beginners python – please comment if you see bugs.
P.P.S The units in the commands above are steps of the motor.  How that corresponds to millimeters or degrees depends on the radius of the wheels and their separation. My by luck gives me about 90 degree turn for 100 steps.

 

Leave a Reply

Your email address will not be published. Required fields are marked *