import cwiid wm = cwiid.Wiimote()
import time for i in range(16): wm.led = i time.sleep(.5)
for i in range(16): wm.led = i wm.rumble = 1-i%2 time.sleep(.2)
wm.rpt_mode = cwiid.RPT_BTN
wm.state
{'led': 15, 'rpt_mode': 2, 'ext_type': 0, 'buttons': 2, 'rumble': 0, 'error': 0, 'battery': 147}
wm.state['buttons']
dir(cwiid)
bool(wm.state['buttons'] & cwiid.BTN_A)
wm.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_ACC wm.state
{'acc': (126, 127, 152), 'led': 15, 'rpt_mode': 6, 'ext_type': 0, 'buttons': 0, 'rumble': 0, 'error': 0, 'battery': 147}
import cwiid import time print 'Press 1+2 on your Wiimote now...' wm = cwiid.Wiimote() time.sleep(1) wm.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_ACC wm.led = 1 while True: wm.rumble = (wm.state['acc'][0] < 126) if wm.state['buttons'] & cwiid.BTN_A: wm.led = (wm.state['led'] + 1) % 16 time.sleep(.2)