Test rig :- 4 IRs dangling from space
Its basically a Nintendo WiiMote camera which is able to track 4 infra red leds/laser giving XY coordinates and also the size of the blob seen.
The WiiMote camera is an i2c devise however its a little dum as you have to kickstart it with a separate 25mhz clock. (deadbug style coz its easier to solder)
In this current application I am sending the received Blobs via a parsed SVG packet to the w3.org web site....which inturn sends me back a neat SVG graphic which is displayed to my phone via webpage.
Here below is the juicy part of the code:-
String out = ""; char temp[200]; out += "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"1000\" height=\"800\">\n"; out += "<g >\n"; // Start our data string sprintf(temp, "<circle cx=\"%d\" cy=\"%d\" r=\"%d\" stroke=\"black\" />\n" ,ircam.Blob1.X,ircam.Blob1.Y,ircam.Blob1.Size*5); out +=temp; |
After a shoutbox exchange Kwatters gave me additional input on how to calculate angles between vectors.
link :- http://stackoverflow.com/questions/1211212/how-to-calculate-an-angle-from-three-points
Update 20160221 .... a few days later :-
Here is the resulting code that appears to work, please note result is given in radians (so multiply by 57.2958 to get the degrees)
p1x=ircam.Blob1.X; p1y=ircam.Blob1.Y;
p2x=ircam.Blob2.X; p2y=ircam.Blob2.Y;
p3x=ircam.Blob3.X; p3y=ircam.Blob3.Y;