Poll
Question: What do you think of this idea?
Very useful - 3 (42.9%)
Interesting - 3 (42.9%)
No idea - 1 (14.3%)
Total Voters: 7

Pages: [1]   Go Down
Author Topic: In-browser Arduino interaction with HTML and JavaScript  (Read 1753 times)
0 Members and 1 Guest are viewing this topic.
Sydney
Offline Offline
Full Member
***
Karma: 1
Posts: 108
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
/* 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);
alert(data);
}
Controlling a servo
Code:
/* create servo object */
var myServo = new Servo();
/* attach servo to pin 3 */
myServo.attach(3);
/* set servo angle */
myServo.write(90);
/* get servo angle */
var angle = myServo.read();
alert("Current angle is " + angle);


* ardugate.png (89.66 KB, 787x727 - viewed 188 times.)

* ardugate_start_window.jpg (80.53 KB, 656x538 - viewed 175 times.)
« Last Edit: May 21, 2012, 04:32:15 am by stanleyhuang » Logged


Newcastle, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 239
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13471
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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.
Logged

Rob Tillaart

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

Sydney
Offline Offline
Full Member
***
Karma: 1
Posts: 108
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

EEPROM access and Servo control are just added.
Logged


Sydney
Offline Offline
Full Member
***
Karma: 1
Posts: 108
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I2C access is added.
Logged


Pages: [1]   Go Up
Jump to: