actions_tts = [ no_action_tts, tilt_left_tts, tilt_right_tts, tilt_up_tts, shake_me_tts ] accel = Accel() NOACTION = 0 LEFT = 1 RIGHT = 2 UP = 3 SHAKE = 4 # Ready to play? SCORE_NEEDED = 10 period = 300 ready_tts.play().wait() while True: request = random.randint(1, 4) action = NOACTION actions_tts[request].play().wait() tilt_left_score = 0 tilt_right_score = 0 tilt_up_score = 0 shake_me_score = 0 for i in range(period): x, y, z = accel.forces() if x < -0.75: tilt_right_score += 1 if x > 0.75: tilt_left_score += 1
shake_me_tts, no_action_tts, detect_tts, wrong_tts, right_tts, try_again_tts]: speech.volume = 400 accel = Accel() NOACTION = 0 LEFT = 1 RIGHT = 2 UP = 3 SHAKE = 4 # Ready to play? SCORE_NEEDED = 10 period = 300 ready_tts.play().wait() while True: request = random.randint(1,4) action = NOACTION actions_tts[request].play().wait() tilt_left_score = 0 tilt_right_score = 0 tilt_up_score = 0 shake_me_score = 0 for i in range(period): x, y, z = accel.forces() if x < -0.75: tilt_right_score += 1 if x > 0.75: tilt_left_score += 1
def speech_manual_play(): '''The text "These aren't the droids you're looking for." will play on the speaker.''' s = Speech("These aren't the droids you're looking for.") s.play() s.wait()
def speech_play(): s = Speech("Test") s.play() s.wait() return True
def speech_manual_play(): '''The text "These aren't the droids you're looking for." will play on the speaker.''' s = Speech("These aren't the droids you're looking for.") s.play() s.wait()
def speech_play(): s = Speech("Test") s.play() s.wait() return True