Communication between Arduino and javascript in a local server using MAMP, processing, JSON and AJAX. This Example uses 3 potentiometers and arduino to control the "r" - "g" - "b" values of a javascript canvas. The values are sent through the serial port to a processing sketch which writes a JSON object with the data. The object is then pulled by the javascript using JQUERY and AJAX.
Note: This communication will only work with a local server. Use MAMP or any other software for this.
- After downloading all the files, copy them inside your local host server folder. If you are using MAMP, copy to: Applications/MAMP/htdocs
- Build a simple circuit using arduino and 3 potentiometers conected to analog inputs 1, 2, and 3.
- Upload the code located inside the folder "controller" to the arduino and close the arduino IDE.
- Run the processing sketch located inside the folder serialToText (it might take a couple of times before it runs correctly).
- On your web browser type: localhost.
- Enjoy!!!!
-