Maqueen Plus V2.0 and 2.1 with microPython library
I wanted my students to learn Python and I have Maqueen V2 that I used with MakeCode. I searched for a library and there is only one for V1. So I decided to make one. This is for the microPython online editor at https://python.microbit.org/v/3/. I am using a group of Maqueen Plus V2.0 and 2.1 robots. The 2.1 robots are a bit different than 2.0.
The github repository is at https://github.com/jdonwells/micropython-MaqueenPlusV2. You will need to add the py file to your project as a separate file or cut and paste directly into main.py if you want.
One thing I don't have yet is the digital IR line following. I have included analog because that lends itself better to PID algorithms.
If there are bugs or something you want let me know.
James thank you for this, I run a Saturday Club for young Roboteers (age 7 - 12 years old) we use the micro-bit, however we do not have Internet access where the club is run and only old laptops with Linux Mint on or RPI's so I have to code the robots at home. I have a couple of Maqueen Plus V2 and will now use your library and the Thonny editor to see if we can get the kids programming the Maqueens using Micro python, we also have available some RP Pico's which will be the next stage after we crack the Maqueens.
Best Wishes
Stephen
codeandpiExample python program for a Robot Pet.
from microbit import *
from maqueenplusv2 import *
init_maqueen()
display.show(Image('00000:'
'09090:'
'00500:'
'60006:'
'07770'))
while True:
if button_b.was_pressed():
sleep_ms(200)
spin_right(50)
sleep_ms(200)
spin_left(50)
sleep_ms(400)
spin_right(50)
sleep_ms(200)
backup(50)
sleep_ms(200)
drive(50)
sleep_ms(200)
stop()
elif button_a.was_pressed():
sleep_ms(200)
spin_right(100)
sleep_ms(1800)
stop()
elif pin_logo.is_touched():
for _ in range(4):
display.show(Image('09090:'
'00500:'
'60006:'
'07770:'
'00000'))
sleep_ms(100)
display.show(Image('00000:'
'09090:'
'00500:'
'60006:'
'07770'))
sleep_ms(100)