Go Down

Topic: In-browser Arduino interaction with HTML and JavaScript (Read 2143 times) previous topic - next topic


May 18, 2012, 11:20 am Last Edit: May 21, 2012, 11:32 am by stanleyhuang Reason: 1
ArduGate is an open-source web gateway software I am developing, for interfacing Arduino with JavaScript. It is actually made up of a serial-to-HTTP gateway (based on my miniweb project), some JavaScript routines performing communication with AJAX and an agent sketch running on Arduino.
It makes interaction between in-browser JavaScript and Arduino possible, and thus makes developing a up-stream application for Arduino that runs on any platform with a browser a lot easier.

You can find more information and download it on the project homepage.
Right now access to following Arduino APIs/objects are implemented:

  • pinMode

  • digitalRead/digitalWrite

  • analogRead/analogWrite

  • EEPROM (read/write)

  • Servo (attach/detach/read/write)

The key concept is using JavaScript inside the web browser to interact with Arduino. Here are several demostrating JavaScript code clips. You will find the code similar to that in an ordinary Arduino sketch.

Accessing EEPROM
Code: [Select]
/* write a byte of 0x80 to EEPROM at address 0xA0*/
var address = 0xA0;
var data = 0x80;
if (EEPROM.write(addr, data))
/* success, now read back from EEPROM */
data = EEPROM.read(addr);

Controlling a servo
Code: [Select]
/* create servo object */
var myServo = new Servo();
/* attach servo to pin 3 */
/* set servo angle */
/* get servo angle */
var angle = myServo.read();
alert("Current angle is " + angle);
My Arduino blog: http://arduinodev.com/blog


it looks pretty cool and I looking forward to seeing it released


Very usefull, next step might even be an IDE in Javascript?

Then Arduino would become somewhat on par with the MBED development system in the cloud.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


EEPROM access and Servo control are just added.
My Arduino blog: http://arduinodev.com/blog


My Arduino blog: http://arduinodev.com/blog

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131