I am trying to make a Lego play piano from ev3, where I have connected two arms to a single motor on either side using Lego elements. Both the arms move counterclockwise to one another (if one plays the key then another won't), the problem is that I need one of the arms to double tap on the key without the motor moving 360 degrees. How do I do it? I have used run_time
, run_target
, and run_angle
but nothing seems to work.
#!/usr/bin/env pybricks-micropython
from pybricks import ev3brick as brick
from pybricks.ev3devices import *
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor, InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import Port
from pybricks.tools import wait
# Play a sound.
brick.sound.beep()
# Initialize a motor at port B.
test_motora=Motor(Port.A)
test_motorb = Motor(Port.B)
test_motorc = Motor(Port.C)
test_motord=Motor(Port.D)
test_motord.run_target(500,-180)
test_motord.run_time(500,2000)
wait(1000)
test_motord.run_target(500,0)
test_motord.run_time(500,2000)