from cubroid import dc_motor, led, sound, master, sleep from cubroid.ai import camera, pose camera.start() pose.start() sleep(2) print("Двигай телом и танцуй с роботом!") prev_action = "" while True: lw = pose.left_wrist() rw = pose.right_wrist() nose = pose.nose() if lw and rw and nose: l_up = lw["y"] < nose["y"] r_up = rw["y"] < nose["y"] if l_up and r_up and prev_action != "both": dc_motor.speed(200, 50) led.face("love") master.rainbow(0.2) sound.play("high_do") prev_action = "both" elif l_up and not r_up and prev_action != "left": dc_motor.speed(50, 200) led.face("happy") master.rgb(0, 0, 255) sound.play("sol") prev_action = "left" elif r_up and not l_up and prev_action != "right": dc_motor.speed(200, 50) led.face("happy") master.rgb(255, 0, 255) sound.play("mi") prev_action = "right" elif not l_up and not r_up and prev_action != "down": dc_motor.stop() led.face("sleepy") master.off() prev_action = "down" sleep(0.2)