[Wiki] The Pokitto Robot Car, Part 2

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!

Note: here is a link to the part 1: [Wiki] The Pokitto Robot Car, Part 1

6 Likes

For his absolutely exceptional work on the MicroPython, in combination of implementing it on a new technical gadget and for writing a long article about MicroPython on Pokitto for Skrolli Magazine, I hereby award @hanski with the first ever Wizard King badge. I think we can all agree that the merits are plentiful.

Congratulations to Hanski!

EDIT: just a reminder: Wizard badges are awarded for exceptional hackery on the Pokitto platform.

6 Likes

Wow, thanks! That is a very nice badge! It has been a fun ride until now and only getting better in the future :slight_smile:

3 Likes

All hail the Wizard King ! :raised_hands:

3 Likes