After seeing the abilities and hackibility of wiimotes I really want to use it in my 'Intro to programming' final. Everyone must make a python program and present it to the class.
I want to make a game with pygame incorporating a wiimote. I found pywiiuse which is a very basic wrapper for the wiiuse library using c types.
I can NOT get anything beyond LEDs and vibrating to work. Buttons, IR, motion sensing, nothing. I've tried different versions of wiiuse, pywiiuse, even python. I can't even get the examples that came with it to run. Here's the code I made as a simple test. I copied some of the example C++ code.
from pywiiuse import *
from time import sleep
#Init
wiimotes = wiiuse_init()
#Find and start the wiimote
found = wiiuse_find(wiimotes,1,5)
#Make the variable wiimote to the first wiimote init() found
wiimote = wiimotes.contents
#Set Leds
wiiuse_set_leds(wiimote,WIIMOTE_LED_1)
#Rumble for 1 second
wiiuse_rumble(wiimote,1)
sleep(1)
wiiuse_rumble(wiimote,0)
#Turn motion sensing on(supposedly)
wiiuse_motion_sensing(wiimote,1)
while 1:
#Poll the wiimotes to get the status like pitch or roll
if(wiiuse_poll(wiimote,1)):
print 'EVENT'
And here's the output when I run it.
wiiuse version 0.9
wiiuse api version 8
[INFO] Found wiimote [assigned wiimote id 1].
EVENT
EVENT
Traceback (most recent call last):
File "C:\Documents and Settings\Nick\Desktop\wiimotetext.py", line 26, in <mod
ule>
if(wiiuse_poll(wiimote,1)):
WindowsError: exception: access violation reading 0x00000004
It seems each time I run it, it prints out EVENT 2-5 times until the trace back. I have no clue what to do at this point, I've been trying for the past two days to get it working.
Thanks!
I updated the pywiiuse wrapper. It didn't seem to be made for the latest version of wiiuse (0.12 at the time of this answer), since much of it just wouldn't work in the current iteration.
I've got the package and some example scripts posted here: http://code.google.com/p/pywiiuse/downloads/list
You should also just be able to do
easy_install wiiuse
Since I've also hosted it on pypi.