Python with Wiimote using pywiiuse module

After watching the abilities and hacking wiimotes, I really want to use it in the final of "Intro to programming". Everyone should make a python program and present it to the class.

I want to make a game with pygame including wiimote. I found pywiiuse , which is a very simple wrapper for wiiuse using c types.

I can’t get anything but LEDs and vibrate to work. Buttons, IR, motion sensors, nothing. I tried different versions of wiiuse, pywiiuse, even python. I can’t even cite the examples that came with him to run. Here is the code I made as a simple test. I copied the sample code in C ++.

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 is the conclusion 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

, , , EVENT 2-5 , . , , .

!

+3
8

pywiiuse. -, wiiuse (0.12 ), .

, : http://code.google.com/p/pywiiuse/downloads/list

easy_install wiiuse

pypi.

+3

Python Wiimote, :

pywiimote ( Google): , , (r52), , .

pywiiuse (. ): ,

cwiid: , Linux ( Cygwin).

- (3/24/2009). ...

- Bryan

+1

, , , , cwiid . Ubuntu :

apt-get install libcwiimote-dev python-cwiid

github.

wiimote (, ) :

import cwiid
print 'place wiimote in discoverable mode (press 1 and 2)...'
wiimote = cwiid.Wiimote()
wiimote.rpt_mode = cwiid.RPT_ACC
#wiimote.state dict now has an acc key with a three-element tuple
print 'pitch: %d' % (wiimote.state['acc'][cwiid.Y])
+1

, , Wii Remote python lightblue. OS X, - ( Linux)

: http://smus.com/prototyping-wii-remote-python/

+1

wiimotelib .NET, . wii , nunchcuk .

+1

pywiimote Google Code , ... .

, , .

!

0

, WiimoteWhiteboard Java Uwe Schmidt

http://www.uweschmidt.org/wiimote-whiteboard

WiiRemoteJ Java.

Python, , . , Schmidt Java, , Python.

.

0

python 2.5.2. ,

0

Source: https://habr.com/ru/post/1702282/


All Articles