Wiimote の機能とハック可能性を見た後、「プログラミング入門」の最終回で本当に使いたいと思いました。誰もが Python プログラムを作成し、それをクラスに提示する必要があります。
Wiiリモコンを組み込んだpygameでゲームを作りたいです。c型を使用するwiiuseライブラリの非常に基本的なラッパーであるpywiiuseを見つけました。
LEDと振動以外は何も得られません。ボタン、IR、モーションセンサー、何もありません。wiiuse、pywiiuse、さらにはpythonのさまざまなバージョンを試しました。付属の例を実行することさえできません。簡単なテストとして作成したコードを次に示します。サンプル 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'
そして、これが実行時の出力です。
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回出力されるようです。この時点で何をすべきかわかりません。過去 2 日間、機能させるために努力してきました。
ありがとう!