How I got my Wiimote to control a Scratch Game
This blog is something of a howto (especially for myself – when I forget how I did it next week &
have to rerun the entire process!!), something of a moan about how many hurdles I had to
jump to get this to work & Im hoping something of an encouragement to similar non technical
‘ICT turned Computing’ teachers who would like to do similar projects and think they are the
only one who doesn’t know their script from their scratch.
Several months ago now @MartinBateman demonstrated a game he
had made in scratch that was then controlled by a wiimote.
Here’s Martin’s presentation from that Raspberryjam on YouTube…
I thought this would be an excellent classroom project to encourage
the kids to make scratch games. Especially if I allowed them up to play it on the
whiteboard at the end of the lesson as a reward for the best design.
So I accessed Martin’s blog & downloaded the Python code he recommends HERE in the video…..
I already have python 2.6 & 3.2 (http://www.python.org/getit/)
so once I’d copied & pasted the code in I thought it would be as simple as pressing run.
Maybe its me being naive but when you’re used to using MSoffice & passing any slightly
technical hiccup to IT support hitting a hurdle that you’re going to have to solve yourself is quite daunting.
Anyway the hiccup presented itself in the form of bad indentation that neither version of python liked.
Given that this was script I had never seen before & my python is still fairly amateur I finally got
it to run & had a momentary swell of pride that I’d dealt with the problem myself.
That was when it spat back an error message about not having the cwiid library! 8….-(
An HOUR of googling later I slowly started to realise that this cwiid thing is just for
Linux & having searched desperately for a Windows version and finding nothing I had
to accept that it wasn’t going to work for me on a W7 pc.
Feeling uncharacteristically brave after my earlier success with the indents & having
had several cups of coffee at this point….
I decided – how hard can it be ….. so I googled around and found this game on the Scratch website.
Again, naively, I just pressed go & expected it to just work… I mean why wouldnt it? 🙂
I went searching through the associated forum and found reference to something
called GlovePi. Which I then downloaded from here…
I found a tutorial series on YouTube, here…..
& I had to google how to enable my bluetooth here…
I even had to google how to make the wiimote discoverable!
I C&Ped the code from the scratch forum here….
into GlovePi hit run & tried to play the game…
(About half an hour later after finally getting an old bluetooth dongle that actually worked…)
After fiddling with the code a little (as you can see above) so that I didn’t die
instantly every time I started the game.
I had success!! 🙂
My next mission is to actually learn how the code works – Ive made a start on this already by following the YouTube tutorials about GlovePie mentioned above. So far Ive just turned the lights on & off, but I saw a nice example of counting to 10 in binary using the lights – I think I’ll try that. 🙂
|was done using this code….|
|row 2, cell 1||row 2, cell 2|
There are some other fun projects using GlovePie and a Wiimote here.