Example #1
0
# Main usage loop
while not done:
    # Poll the wiimotes for button/motion events
    r = wiiuse.poll(wiimotes, num_motes)

    if r != 0:
        # If there are any events, check for a pressed button
        button_pressed = button_handler.press_event()

        if button_pressed == wiiuse.button['B']:
            os.system('clear')
            print "\nRecognizing gesture...\n"

            # Collect data from the user's performed gesture.
            performed_gesture = gesture_creator.perform_gesture()

            if performed_gesture is None:
                # If the gesture has no length, prompt the user to try again
                time.sleep(STANDARD_SLEEP_TIME * 5)
                print "..."
                time.sleep(STANDARD_SLEEP_TIME * 5)
                print "Uh-oh!  That gesture had no length.  Try again."
                time.sleep(STANDARD_SLEEP_TIME * 5)
                main_prompt()
                continue

            # if testing:
            #     performed_gesture = test_gesture
            #     test(performed_gesture)
Example #2
0
# Main usage loop
while not done:
    # Poll the wiimotes for button/motion events
    r = wiiuse.poll(wiimotes, num_motes)

    if r != 0:
        # If there are any events, check for a pressed button
        button_pressed = button_handler.press_event()

        if button_pressed == wiiuse.button['B']:
            os.system('clear')
            print "\nRecognizing gesture...\n"

            # Collect data from the user's performed gesture.
            performed_gesture = gesture_creator.perform_gesture()

            if performed_gesture is None:
                # If the gesture has no length, prompt the user to try again
                time.sleep(STANDARD_SLEEP_TIME * 5)
                print "..."
                time.sleep(STANDARD_SLEEP_TIME * 5)
                print "Uh-oh!  That gesture had no length.  Try again."
                time.sleep(STANDARD_SLEEP_TIME * 5)
                main_prompt()
                continue

            # if testing:
            #     performed_gesture = test_gesture
            #     test(performed_gesture)