Giter Club home page Giter Club logo

arduinoethernetcom's Introduction

ArduinoEthernetCom: Simple communication between Arduinos and Browsers

The ArduinoEthernetCom library was created to simplify communication between Arduinos and browsers without requiring Flash or Java or drivers or anything else.

ArduinoEthernetCom allows you to create a simple server on an Ethernet-enabled Arduino (i.e. an Arduino with an Ethernet shield, or an ArduinoEthernet) by uploading a tiny sketch to the device, and then stream data into the browser over an Ethernet connection. You can see an example running live on GitHub here.

To read more about streaming data to your computer over an Ethernet cable, read this blog post.

License

ArduinoEthernetCom is Copyright 2012 (c) by the Concord Consortium and is distributed under any of the following licenses:

Using the library

// Define an ArduinoEthernetCom with optional options
var arduinoEthernetCom = new ArduinoEthernetCom(_options_);

// Define one or more observers to be notified each time the data updates
var dataDidUpdate = function(data) {
  var pinA0Value = data.A0;           // data is returned as a hash of values
  graph(pinA0Value)                   // do whatever
}

arduinoEthernetCom.addObserver(dataDidUpdate);

// start polling the Arduino, calling all the observers each time with data
arduinoEthernetCom.start();

// some time later
arduinoEthernetCom.stop();

// this will grab the current values of the pins. This is probably not as useful
// as the start() method, which continually polls the data.
arduinoEthernetCom.getData();

Options

You can pass a hash of options to ArduinoEthernetCom, e.g. var arduinoEthernetCom = new ArduinoEthernetCom({frequency: 2, generate_random_data: true});

  • arduino_server_ip:
  • frequency:
    • Frequency of data collection in Hertz. Default: 4 (i.e. we will request data 4 times a second)
  • delay_time:
    • Alternative way of defining frequency, in ms. Default: None, the above already defines 250 ms
  • generate_random_data:
    • If true, random floating voltages will be generated for all 6 pins. This means you don't need to connect an Arduino, so it can be used for testing. Default: false
  • callback_function_name:
    • The function called by the Arduino's script to send JSON-P data. This shouldn't be changed unless the sketch is modified. Default: arduinoEthernetComCallback

Using this with an Arduino on a web page

  1. Upload the server sketch located at Arduino/JSONPSensorServer.ino to the Arduino. This will start a server running at http://169.254.1.1. If you need to use a different IP address, you must modify the sketch.
  2. Plug the Arduino into the computer with an Ethernet cable. Wait about 30 seconds for the server to boot up.
  3. Use the ArduinoEthernetCom library to get data from the Arduino.

arduinoethernetcom's People

Contributors

sfentress avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.