I was at my father's, in my room where light is provided by a simple light bulb attached on the ceiling, and I was looking at the code of a WiimoteLib sample (a C#.NET windows form application). While I was running the sample, I figured out that when I pointed the wiimote somewhere on the screen of my laptop (a glossy and reflective screen), the "IR 1" checkbox was pressed, but then it was toggling randomly when getting away from that specific point on the screen.
Meanwhile, I was trying to figure out what the black box in the form was used for. According to the properties window in Visual studio, it was a picture box called pbIR, which meant it had to do with IR; then I looked up the OnWiimoteChanged event handler in the form code, and I figured out that the graphic being displayed on that picture box was used to draw the IR position, with the following code:
g.Clear(Color.Black);
if(ws.IRState.Found1)
g.DrawEllipse(new Pen(Color.Red), ws.IRState.RawX1 / 4, ws.IRState.RawY1 / 4, ws.IRState.Size1+1, ws.IRState.Size1+1);
if(ws.IRState.Found2)
g.DrawEllipse(new Pen(Color.Blue), ws.IRState.RawX2 / 4, ws.IRState.RawY2 / 4, ws.IRState.Size2+1, ws.IRState.Size2+1);
BeginInvoke((MethodInvoker)delegate(){pbIR.Image = b;});
So basically, this code would draw in red (for IR 1) and in blue (for IR 2) a circle at the appropriate position. Then I ran the app again, and when the IR 1 checkbox was checked, I was actually seeing a red circle moving around, in the same way I was moving the wiimote!!! Without an IR bar!
The screenshot was taken at home; where my screen reflects more than 2 light bulbs (that's why you can see both IR1 and IR2 on, i.e. red and blue)
Just to have fun with it a little bit, I launched WiinRemote and used the wiimote to control my cursor through IR, and it worked pretty well! But I was starting to wonder how all this could happen without any sort of IR led anywhere...
First I noticed that when I was pulling my screen too much towards me, the thing wasn't working any more. Then I tried to put my hand in front of the wiimote in different places, so that I could find out where this IR light was coming from: it was in the middle of the screen, and not elsewhere... Then I looked from the wiimote's standpoint, and I saw ... the light bulb, which was reflected by the glossy screen! To make sure it was it, I tried by pointing the wiimote towards that light bulb directly, and, sure enough, it did work.
So there you have it, a new way to use the wiimote IR capability, without an IR bar!
p.s. wish I had a camera... or even just a working cell phone camera... (my nokia 6600 can save the pictures I take, but then I can't copy them on my computer... it's either the phone (which behaves in a strange way always), or the memory card, I dunno, but I want an iPhone!!!)
1 comment:
Yes thats right, i am working with the Whiteboard application of Johnny Lee. It's clear that the Wiimote sees all kinds of IR.
Bulbs and candles also emit IR.
And thats good to know...
//Bart
Post a Comment