| The Following 7 Users Say Thank You to thp For This Useful Post: | ||
|
|
2010-08-12
, 13:54
|
|
Posts: 999 |
Thanked: 1,117 times |
Joined on Dec 2009
@ earth?
|
#2
|
|
|
2010-08-13
, 08:02
|
|
Posts: 200 |
Thanked: 300 times |
Joined on Nov 2009
@ The Netherlands
|
#3
|
|
|
2010-08-13
, 11:55
|
|
|
Posts: 1,390 |
Thanked: 4,262 times |
Joined on Sep 2007
@ Vienna, Austria
|
#4
|
Is there also a possibility in the future to read out the camera of the wiimote?
{'led': 1, 'ir_src': [{'pos': (475, 281), 'size': 1}, {'pos': (560, 663), 'size': 1}, {'pos': (723, 134), 'size': 3}, None], 'rpt_mode': 8, 'ext_type': 0, 'rumble': 0, 'error': 0, 'battery': 99}
| The Following User Says Thank You to thp For This Useful Post: | ||
|
|
2015-06-07
, 20:07
|
|
Posts: 1 |
Thanked: 0 times |
Joined on Jun 2015
|
#6
|
Now, fire up a Python shell ("python" in X Terminal) and enter the following code:
Let's play a bit with the LEDs:
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){'led': 15, 'rpt_mode': 2, 'ext_type': 0, 'buttons': 2, 'rumble': 0, 'error': 0, 'battery': 147}{'acc': (126, 127, 152), 'led': 15, 'rpt_mode': 6, 'ext_type': 0, 'buttons': 0, 'rumble': 0, 'error': 0, 'battery': 147}Here's the code, you can abort it with Ctrl+C:
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)