def start( self ): found = wii.find( self._pointer, self._nmotes, 5 ) assert found print( 'found wiimotes', found ) connected = wii.wiiuse_connect( self._pointer, self._nmotes ) # NOT wii.connect assert connected print( 'connected wiimotes', connected ) for i in range( self._nmotes ): wm = self._pointer[i] wii.motion_sensing(wm, 1) wii.set_leds( wm, wii.WIIMOTE_LED_2) self._active = True return found
def start(self): found = wii.find(self._pointer, self._nmotes, 5) assert found print('found wiimotes', found) connected = wii.wiiuse_connect(self._pointer, self._nmotes) # NOT wii.connect assert connected print('connected wiimotes', connected) for i in range(self._nmotes): wm = self._pointer[i] wii.motion_sensing(wm, 1) wii.set_leds(wm, wii.WIIMOTE_LED_2) self._active = True return found
def connect( self ): print('press 1+2 buttons on wiimote(s) now...') found = wii.find( self._pointer, self._nmotes, 5 ) print( 'found wiimotes', found ) if not found: return 0 ## NOT wii.connect - this is the raw bluetooth connect function connected = wii.wiiuse_connect( self._pointer, self._nmotes ) assert connected print( 'connected wiimotes', connected ) while len(self.wiimotes) < connected: index = len(self.wiimotes) mote = Wiimote( index = index, pointer = self._pointer[ index ] ) self.wiimotes.append( mote ) self._active = True if self._threading: self.start() return found
#!/usr/bin/python # updated Nov 2011 import os, sys, time import wiiuse as wii MAX_WIIMOTES = 2 context = wii.init(MAX_WIIMOTES) print(context) found = wii.find(context, MAX_WIIMOTES, 5) assert found print('found wiimotes', found) #connected = wii.connect( context, found ) # dont get confused by other connect function from bluez connected = wii.wiiuse_connect(context, MAX_WIIMOTES) assert connected wii.set_leds(context[0], wii.WIIMOTE_LED_1)
#!/usr/bin/python # updated Nov 2011 import os,sys, time import wiiuse as wii MAX_WIIMOTES = 2 context = wii.init( MAX_WIIMOTES ) print( context ) found = wii.find( context, MAX_WIIMOTES, 5 ) assert found print( 'found wiimotes', found ) #connected = wii.connect( context, found ) # dont get confused by other connect function from bluez connected = wii.wiiuse_connect( context, MAX_WIIMOTES ) assert connected wii.set_leds( context[0], wii.WIIMOTE_LED_1 )
import sys import struct import ctypes import daemon import socketipc import rencode import wiiuse wm = wiiuse.wiiuse_init(1) print wm fnd = wiiuse.wiiuse_find(wm, 1, 5) print fnd cn = wiiuse.wiiuse_connect(wm, 1) print cn sys.exit() _wiiuse = None if sys.platform[:3] == 'win': _wiiuse = ctypes.cdll.wiiuse elif sys.platform == 'linux2': _wiiuse = ctypes.cdll.LoadLibrary('libwiiuse.so') elif sys.platform == 'darwin': _wiiuse = ctypes.cdll.LoadLibrary('libwiiuse.so') print _wiiuse _wm = _wiiuse.wiiuse_init(1) print _wm
import sys import struct import ctypes import daemon import socketipc import rencode import wiiuse wm = wiiuse.wiiuse_init(1) print wm fnd = wiiuse.wiiuse_find(wm, 1, 5) print fnd cn = wiiuse.wiiuse_connect(wm, 1) print cn sys.exit() _wiiuse = None if sys.platform[:3] == 'win': _wiiuse = ctypes.cdll.wiiuse elif sys.platform == 'linux2': _wiiuse = ctypes.cdll.LoadLibrary('libwiiuse.so') elif sys.platform == 'darwin': _wiiuse = ctypes.cdll.LoadLibrary('libwiiuse.so') print _wiiuse _wm = _wiiuse.wiiuse_init(1) print _wm