Introduction: Control an LED With Your Smartphone
Step 1: Bending the Leads (=
Before We start wiring up the circuit you will want to bend the led and resistor leads to fit your prototyping hardware. The resistor leads will simply be bend downwards in parralel, as shown in photos and the leds will be bent to fit all 4 leads into the breadboard or prototyping hardware you have used.
Step 2: Constructing the Circuit!
The Circuit is Simple if you have ever connected an led before, the common lead, the longest, will be connected to ground and the remaining connections will go through a resistor into 9,10 and 11 PWM pins, (pulse-width-modulation)
PWM is basically flashing the led so fast that the human eye sees it as steadily on just at a lower birightness, different brightnesses are achieved by changing the ratio of which the led is on then off. the pins 9,10 and 11 are simply pulse width modulation compatible.
The very shortest lead (red) will go thorugh a resistor to pin 11, The 2nd shortest (green) will go to pin 10 and finally the blue (remaining lead) will go to pin 9. and incase you havent already wired up the longest lead- it is the negative of each led, this must go to a ground labbleled hole on the arduino.
Step 3: PR0GR4M1NG!
Now we ned to code the arduino to pick up the signals that will the sent by processing which are controlled by your idevice, but we will get to that later. You will need to go to file-examples-firmatta-standardfirmatta and upload that to the arduino using the arduino IDE.
downloadable from: http://arduino.cc/en/Main/Software
Once youve uploaded that to the board you will need to download processing in preperation for the next step: http://www.processing.org/download/
Step 4: Libraries
Once youve downloaded processing, you will need to download 2 libraries to communicate with your idevice and then to the arduino. installation instructions should be included either with the download or the on the download page.
These libraries include:
once installed you will need to download a program called touch osc editor from here: http://hexler.net/software/touchosc
scroll right down to the bottom,its near there.
i have included a link to a premade one and it includes buttons, toggles,flahers and faders. when you press one of these it sends out a message that processing will look for and read. te processing sketch attached will also be set up to read those messages so theres no hard work for you (=. open the touch osc editor file and click the sync button then go onto your idevice , in touch osc select layout-add-and select the host that comes up. make sure your idevice and pc are on the same network.
the basic draw funcions and fader code was made by harryking, on youtube, i have extended it: check him out on youtube (=
download the files here: http://www.mediafire.com/?iosmsvmq4dsyb7p
Step 5: Almost There!
Once you have gotten my two files and synced the touch osc, it is time to run the processing sketch, your arduino must be attached! or you will get errors. you must now look down the bottom and you should see the ip somehwere in the mess of results type his into your processing-osc information. same with the port. if all goes well then whatever you do on the idevice should be mirrored on the red green and blue faders shown. The RGB LED Should Also Be Lighting up. If This Has all gone well then Congradulations, if not there is a troubleshooting section on the next step and also.. dont give up, it worth the time.
Step 6: TroubleShooting!
if you get something like- cannot run in 64 bit mode, download the 1.5.1 version of processing
if you get exception errors, make sure your arduino is plugged in
if you get nothing being mirrored make sure your ip and port are correct and your firewall is not locking it.
and if you are not having fun, then go away :P
any other errors please comment. (=
We have a be nice policy.
Please be positive and constructive.