Exemplo n.º 1
0
    def on_connect(self, myo, timestamp):
		print_("Connected to Myo")
		myo.vibrate('short')
                myo.set_stream_emg(stream_emg.enabled)
		myo.request_rssi()
		global start
		start = time.time()
Exemplo n.º 2
0
    def on_connect(self, myo, timestamp):
        ''' (Listener, Myo, str) -> NoneType
        Vibrates the Myo band once a connection has been established
        '''
        if is_debug:
            print_("Connected to Myo")

        myo.vibrate('short')
        myo.request_rssi()
Exemplo n.º 3
0
def opponentChoice(userChoice,myo):
    choice=random.randint(1,3)
    if choice==1:
        print_("Opponent chose Scissors!")
        if choice==userChoice:
            write_message("Tie!", GAME.me, GAME.opponent)
            print_c_scissors(display_width-250, 150)
            print_scissors(75, 150)
        elif 2==userChoice:
            GAME.opponent+=1
            write_message("You Lose!", GAME.me, GAME.opponent)
            print_c_scissors(display_width-250, 150)
            print_paper(75, 150)
            myo.vibrate('long')
        else:
            GAME.me+=1
            write_message("You Win!", GAME.me, GAME.opponent)
            print_c_scissors(display_width-250, 150)
            print_rock(75, 150)
    elif choice==2:
        print_("Opponent chose Paper!")
        if choice==userChoice:
            write_message("Tie!", GAME.me, GAME.opponent)
            print_c_paper(display_width-250, 150)
            print_paper(75, 150)
        elif 1==userChoice:
            GAME.me+=1
            write_message("You Win!", GAME.me, GAME.opponent)
            print_c_paper(display_width-250, 150)
            print_scissors(75, 150)
        else:
            GAME.opponent+=1
            write_message("You Lose!", GAME.me, GAME.opponent)
            print_c_paper(display_width-250, 150)
            print_rock(75, 150)
            myo.vibrate('long')
    else:
        print_("Opoonent chose Rock!")
        if choice==userChoice:
            write_message("Tie!", GAME.me, GAME.opponent)
            print_c_rock(display_width-250, 150)
            print_rock(75, 150)
        elif 2==userChoice:
            GAME.me+=1
            write_message("You Win!", GAME.me, GAME.opponent)
            print_c_rock(display_width-250, 150)
            print_paper(75, 150)
        else:
            GAME.opponent+=1
            write_message("You Lose!", GAME.me, GAME.opponent)
            print_c_rock(display_width-250, 150)
            print_scissors(75, 150)
            myo.vibrate('long')
Exemplo n.º 4
0
 def on_connect(self, myo, timestamp):
     print_("Connected to Myo")
     myo.vibrate('short')
     myo.request_rssi()
Exemplo n.º 5
0
 def on_connect(self, myo, timestamp):
     print_("Connected to Myo")
     myo.vibrate('short')
     myo.request_rssi()
Exemplo n.º 6
0
 def on_connect(self, myo, timestamp):
     print_("Connected to Myo")
     myo.vibrate('short')
     myo.request_rssi()
     myo.set_stream_emg(stream_emg.enabled)
     print_("Enabling EMG")
Exemplo n.º 7
0
 def on_connect(self, myo, timestamp):
     myo.vibrate('short')
     self.connected = True
     myo.request_rssi()
Exemplo n.º 8
0
 def on_connect(self, myo, timestamp):
     myo.vibrate('short')
     myo.request_rssi()
Exemplo n.º 9
0
 def on_connect(self, myo, timestamp):
     print_("Connected to Myo")
     myo.vibrate('short')
     myo.request_rssi()
     myo.set_stream_emg(stream_emg.enabled)
     print_("Enabling EMG")