Giter VIP home page Giter VIP logo

nodebot-with-express-sparkjs-and-particle-io's Introduction

#nodebot with express, sparkjs and particle-io

A proof of concept for communicating between a Particle Photon board and an express server via events.

alt tag

The express server will first publish an event named Foo with a value. The server will then listen for any events named Bar
On the event of Bar, the server will emit Foo again - with a value.

The device will listen for any events named Foo. On the event of Foo, the device will :

  • turn the LED on or off
  • emit Bah with a value.

##Requirements

Make sure you've flashed your Photon with the voodoospark firmware.

It is also recommended that you store your Particle token/device ID in a dot file like .particlerc so they can be accessed as properties of process.env.

Make sure you include your login/password creds at the bottom of device.js and server.js. You could also just store these in your .particlerc.

##Usage

Install the dependencies:

% npm install

Because I'm a slave to ES6, you'll need to make sure you have babel installed:

% npm install -g babel

First run the device.js script so the Photon is ready and listening. I've included the port the micro USB is connected to.
To find you port run ls /dev/tty.* (Mac)

% babel-node index.js device.js /dev/cu.usbmodem1421

Now the device is ready, run the server in another terminal window:

% babel-node server.js

If you've wired things up correctly, you should have a flashing LED that turns on every time Bar is emitted. I just included the button for funsies using particle-io.

nodebot-with-express-sparkjs-and-particle-io's People

Contributors

chrisbuttery avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

valleyapps

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.