Raspberry pi を Wiiリモコンでコントロール
Raspberry pi を外部から制御するように Wiiリモコンを使ってみようと思ったところ下記のように簡単にできるようだ
Raspberry pi から Wiiリモコンが見えているか確認
pi@raspberrypi:~ $ hcitool scan
Scanning ...
00:19:1D:29:F5:34 Nintendo RVL-CNT-01
まずは Python をインストール
$ sudo apt-get update
$ sudo apt-get install python-dev
cwiid をインストール
$ sudo apt-get install python-cwiid
適当なディレクトリを作って、テストプログラムをダウンロード
$ mkdir wiimote
$ cd wiimote
$ wget https://www.raspberrypi.org/learning/robo-butler/code/wii_remote_1.py
実行してみた
pi@raspberrypi:~/wiimote $ python wii_remote_1.py
Press 1 + 2 on your Wii Remote now ...
No wiimotes found
Error opening wiimote connection
なんかエラーが出たと思ったら、sudo を忘れていた
pi@raspberrypi:~/wiimote $ sudo python wii_remote_1.py
Press 1 + 2 on your Wii Remote now ...
Wii Remote connected...
Press some buttons!
Press PLUS and MINUS together to disconnect and quit.
Button 1 pressed
Button 2 pressed
Left pressed
Left pressed
Right pressed
Right pressed
Down pressed
Up pressed
Right pressed
Left pressed
Left pressed
Down pressed
Down pressed
Left pressed
Right pressed
Right pressed
Up pressed
Down pressed
できた。これで Raspberry pi をラジコンとかにして遊んでみようと思う