Untitled
unknown
python
22 days ago
1.1 kB
1
Indexable
Never
import event, time, cyberpi, gamepad, mbot2 @event.start def on_start(): while True: if gamepad.is_key_pressed('R1'): mbot2.servo_set(120,"S1") if gamepad.is_key_pressed('L1'): mbot2.servo_set(180,"S1") if gamepad.is_key_pressed('R2'): mbot2.servo_set(50,"S2") if gamepad.is_key_pressed('L2'): mbot2.servo_set(20,"S2") @event.start def on_start1(): while True: if gamepad.is_key_pressed('Up'): mbot2.forward(200, 1) if gamepad.is_key_pressed('Left'): mbot2.turn(-90) if gamepad.is_key_pressed('Right'): mbot2.turn(90) if gamepad.is_key_pressed('Down'): mbot2.backward(200, 0.2) @event.start def on_start2(): while True: if gamepad.is_key_pressed('N2'): mbot2.forward(50, 0.2) if gamepad.is_key_pressed('N1'): mbot2.turn(-45) if gamepad.is_key_pressed('N4'): mbot2.turn(45) if gamepad.is_key_pressed('N3'): mbot2.backward(50, 0.2)
Leave a Comment