Friday 7 October 2011

iPhone to PC to Hand!

This should be my final Robot Hand instalment folks!

I'm not gonna post the Arduino code because I simply used the "servo firmata" program which is in the examples section of the Arduino software. With the "servo firmata" program loaded onto my Arduino, all I needed to do was figure out some software called "Processing". Processing allows you to do all sorts of things from you pc and other devices. In my case it will allow me to talk to the Arduino from my PC as long as the USB cable is connected between the Arduino and the PC. Best of all, the programming language is pretty much the same as the Arduino!
So anyway, to get the Processing code to work, I first had to add the arduino.cc library and the oscp5 library. The oscp5 library automatically added the netp5 library. Both of these libraries can be found at the following:
With these libraries loaded up, the code I pieced together mainly from the two sources in my last post actually worked!

So before I could actually try this out, I needed to sort the iPhone side of things out. I used software called TouchOSCEditor to create a layout which I then uploaded to my iPhone.
So what happens now is my iPhone sends a signal from which ever button is used in the app. This signal is listened for by processing. Processing then takes that signal and sends an instruction through the USB cable, all the way to the Arduino. And ta-da! A moving robot hand!

Here's the TouchOSC layout I made:
I labelled each of the faders; /1/fader1, /1/fader2, etc, from left to right.




Here's a couple of links for the processing code and the TouchOSC layout. (Remember you only need to use the "servo firmata" program for the Arduino)


robot_hand_serial_processing_code_firmata.pde
robot_hand_fader.touchosc


No comments:

Post a Comment