header new

MicroPython, micro:bit og Bit:Bot

(Part of this page will be in Danish, as the target are kids. There is a small part in English at the bottom).Bit:Bot car

Jeg har skrevet et dokument som beskriver et Coding Pirate forløb med microPython, micro:bit og Bit:Bot bil. 

Det primære formål er at lære at programmere Python ved at bruge en micro:bit og en Bit:Bot bil. Jeg har i den sammenhæng skrevet et Bit:Bot Python modul for at gøre det lettere at programmere bilen. Modulet supporterer både standard bilen og XL bilen (automatisk). Dokumentet beskriver hvordan modulet 'installeres' på micro:bit'en og hvordan det bruges til at styre bilen.

Her er et link til dokumentet: microbit-python.pdf. (version 1.20)

Her er et link til Python modulet: bitbot.py (Vælg 'Gem link som...' bitbot.py)

Det kan godt være svært at få bilen til at 'se' linjen, så jeg har printet nogle skjold, som gør linjerne lettere at 'se'.

Bit:Bot line shields    Bit:Bot line shield2

 

Short English version:Car follow line

I have written a Python Bit:Bot module for the micro:bit and the Bit:Bot car. It support both the classic car and the XL car automaticly. It makes it much easier to program the car as all the hardware registers have been abstracted. It is called bitbot.py and there is a link to it above.

bitbot module explained:

Drive(left, right)
Motor speed [-100; 100], 0=stop, <0 reverse, >0 forward.

ReadLine(sensor)
sensor=LEFT or RIGHT. Return True if black line is visible.

ReadLight(sensor)
sensor=LEFT or RIGHT
Read sensor on top of car and return 0-100 depending on the light.

Buzzer(value)
value=0 or 1 (off or on)

NeoPixel()
Return a NeoPixel object that matches the cars LEDs.

ModelGet()
Return the model type: MODEL_CLASSIC or MODEL_XL

Sonar(max = 100)
Return distance in cm. max distance to wait for reply.