GithubHelp home page GithubHelp logo

imp-io's Introduction

Imp-IO

![Gitter](https://badges.gitter.im/Join Chat.svg)

Build Status

Imp-io is a Firmata-compatibility IO class for writing node programs that interact with Electric Imp devices. Imp-io was built at Bocoup

Getting Started

To communicate with an Electric Imp using Johnny-Five w/ Imp-IO, you will need to upload the special Tyrion agent and device firmware through Electric Imp's IDE. We recommend you review Electric Imp's Getting Started before continuing.

Tyrion Setup

  1. Follow Electric Imp's Getting Started instructions to set up a wifi connection to your Electric Imp device.
  2. Once your Imp is setup, open the IDE (familiarize yourself here) and click Create New Model, give it a name and assign it to your device.
  3. Paste the contents of agent.nut into the Agent pane and device.nut into the Device pane: Imp Setup
  4. Expand the Active Model in the column on the left by click on the rightward arrow. The model will appear below, click on the model.
  5. Click Build and Run to finish preparing your Electric Imp.

Imp-IO Setup

In the Electric Imp IDE, locate and copy the agent id, located in agent url Look for the agent id located in the agent url:

Imp Setup

Store your agent ID in a dot file so it can be accessed as a property of process.env. Create a file in your home directory called .imprc that contains:

export IMP_AGENT_ID="your agent id"

Then add the following to your dot-rc file of choice:

source ~/.imprc

Blink an Led

The "Hello World" of microcontroller programming:

var Imp = require("imp-io");
var board = new Imp({
  agent: process.env.IMP_AGENT_ID
});

board.on("ready", function() {
  console.log("CONNECTED");
  this.pinMode(9, this.MODES.OUTPUT);

  var byte = 0;

  // This will "blink" the on board led
  setInterval(function() {
    this.digitalWrite(9, (byte ^= 1));
  }.bind(this), 1000);
});

Johnny-Five IO Plugin

Imp-IO can be used as an IO Plugin for Johnny-Five:

var five = require("johnny-five");
var Imp = require("imp-io");

var board = new five.Board({
  io: new Imp({
    agent: process.env.IMP_AGENT_ID
  })
});

board.on("ready", function() {
  var led = new five.Led(9);
  led.blink();
});

License

See LICENSE file.

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.