Page 1 of 1

Maqueenplus

Posted: Sat Dec 12, 2020 1:25 pm
by Jackpo
Hallo.
How can i program de robot Maqueenplus. I can not find a schematic from this bot so i don't have pin-numbers how to program the motors.
Thanks.
Jack.

Re: Maqueenplus

Posted: Sun Dec 13, 2020 11:39 pm
by lujo
Hi,

Check out: https://www.dfrobot.com/forum/viewtopic ... 176#p42615

That did not help me: downloads mu-editor with maqueen library distributed
as MS-Windows installer file. No MS-Windows here.

So, figured it out by sending bytes to i2c addr, see what happens.

Here is my line-following program for the mu-editor.

Code: Select all

$ cat maqueen_line_following.py 

from microbit import i2c, display, button_a, button_b, sleep
from microbit import pin13 as ir_left_led, pin14 as ir_right_led
from microbit import accelerometer
from micropython import const

i2c.init()
i2c_addr = const(16)

speed = const(50)

def drive():
  i2c.write(i2c_addr, bytes((0,0,speed)))
  i2c.write(i2c_addr, bytes((2,0,speed)))

def turn_right():
  i2c.write(i2c_addr, bytes((0,0,speed*2)))
  i2c.write(i2c_addr, bytes((2,0,0)))

def turn_left():
  i2c.write(i2c_addr, bytes((0,0,0)))
  i2c.write(i2c_addr, bytes((2,0,speed*2)))

def stop():
  i2c.write(i2c_addr, bytes((0,0,0)))
  i2c.write(i2c_addr, bytes((2,0,0)))

def run():
  p = 0
  while True:
    if accelerometer.is_gesture('face up'):
      stop()
    else:
      i = ir_left_led.read_digital() + 2 * ir_right_led.read_digital()
      if i == 0:
        drive()
      elif i == 1:
        turn_right()
        p = i
      elif i == 2:
        turn_left()
        p = i
      else:
        if p == 1:
          turn_right()
        if p == 2:
          turn_left()

run()
lujo

Re: Maqueenplus

Posted: Mon Dec 14, 2020 10:39 am
by Jackpo
Hallo Iujo

Thanks for answer, but the line: Check out: https://www.dfrobot.com/forum/viewtopic ... 176#p42615
gives: can not find!
What is wrong?
Thanks.
Jack.

Re: Maqueenplus

Posted: Mon Dec 14, 2020 12:27 pm
by lujo
Hi,

Try this: go to https://www.dfrobot.com/forum/viewforum.php?f=7 (the Products
forum) and click Robotics. Search for micropython, read the post by nana.wang.

lujo

Re: Maqueenplus

Posted: Wed Dec 16, 2020 1:26 pm
by Jackpo
Hallo Lujo'

Sorry, but the linefollower program i tried but does not not work.
Jack.