In this course you will learn to build an autonomous robot car, and also learn how to use Pokitto and Python to control it!
The target audience for this course are people with little or no knowledge about electronics and programming, from kids to grown-ups.
This is the part 2 of the Pokitto robot Car Course. In this part, the car finally starts to move autonomously (!). At the same time we learn to make a full Python program, with some own functions and python commands.
Below is the Python program:
# Import e.g. Pin object class. from umachine import * # Create pin objects motorA1 = Pin ( Pin.EXT10, Pin.OUT ) motorA1.off() motorA2 = Pin ( Pin.EXT11, Pin.OUT ) motorA2.off() motorB1 = Pin ( Pin.EXT14, Pin.OUT ) motorB1.off() motorB2 = Pin ( Pin.EXT15, Pin.OUT ) motorB2.off() # Functions def Forwards(): motorA1.on() motorA2.off() motorB1.on() motorB2.off() def Right(): motorA1.on() motorA2.off() motorB1.off() motorB2.on() def Stop(): motorA1.off() motorA2.off() motorB1.off() motorB2.off() # Main while True: # Go forwards for one second Forwards() wait(1000) # Stop for one second Stop() wait(1000) # Turn right until 400 ms has passed Right() wait(400) # Stop for one second Stop() wait(1000)
The Pokitto rom image, which contains the Python REPL interactive prompt:
python_repl.bin (221.9 KB)
The Google Slides document in Finnish:
The Google Slides document in English:
I will make an english translation by request. It will take about two evenings from me. No charge!