IoT em tempo real com Firebase e
JavaScript
Henri Cavalcante
CTO at wiquadro.com.br
@henricavalcante
JavaScript Advantages:
● Fast, very fast
● Asynchronous
● Event-based
● Top 1 language in the world
● Large community
Johnny-Five
Johnny-Five is the original JavaScript
Robotics programming framework. Released
by Bocoup in 2012, Johnny-Five is
maintained by a community of passionate
software developers and hardware
engineers. Over 75 developers have made
contributions towards building a
robust, extensible and composable
ecosystem.
+
Firmata
Firmata is a protocol for communicating with microcontrollers from software
on a computer (or smartphone/tablet, etc). The protocol can be implemented
in firmware on any microcontroller architecture as well as software on any
computer software package (see list of client libraries below).
Flash your Arduino with Standard Firmata:
● Connect the Arduino to your PC using the USB Cable
● Open the Arduino IDE, select: File > Examples > Firmata > StandardFirmata
● Click the "Upload" button.
● The text "Done Uploading" will appear once the upload is complete.
Basic Usage
MCU
Serial
Socket
Sensors
Leds
. . .
const five = require('johnny-five');
const board = new five.Board();
const Firebase = require('firebase');
const relays = new Firebase('https://io16natal.firebaseio.com').child('relay');
board.on('ready', () => {
const lamps = {
'01': new five.Relay(8),
'02': new five.Relay(9),
'03': new five.Relay(10),
'04': new five.Relay(11)
}
relays.on('value', (snap) => {
snap.forEach((lamp) => { lamps[lamp.key()][lamp.val()]() });
});
});
Example
● github.com/henricavalcante
● twitter.com/henricavalcante
● fb.me/henricavalcante

IoT em tempo real com Firebase e JavaScript

  • 1.
    IoT em temporeal com Firebase e JavaScript
  • 2.
    Henri Cavalcante CTO atwiquadro.com.br @henricavalcante
  • 4.
    JavaScript Advantages: ● Fast,very fast ● Asynchronous ● Event-based ● Top 1 language in the world ● Large community
  • 6.
    Johnny-Five Johnny-Five is theoriginal JavaScript Robotics programming framework. Released by Bocoup in 2012, Johnny-Five is maintained by a community of passionate software developers and hardware engineers. Over 75 developers have made contributions towards building a robust, extensible and composable ecosystem. +
  • 9.
    Firmata Firmata is aprotocol for communicating with microcontrollers from software on a computer (or smartphone/tablet, etc). The protocol can be implemented in firmware on any microcontroller architecture as well as software on any computer software package (see list of client libraries below). Flash your Arduino with Standard Firmata: ● Connect the Arduino to your PC using the USB Cable ● Open the Arduino IDE, select: File > Examples > Firmata > StandardFirmata ● Click the "Upload" button. ● The text "Done Uploading" will appear once the upload is complete.
  • 11.
  • 12.
    const five =require('johnny-five'); const board = new five.Board(); const Firebase = require('firebase'); const relays = new Firebase('https://io16natal.firebaseio.com').child('relay'); board.on('ready', () => { const lamps = { '01': new five.Relay(8), '02': new five.Relay(9), '03': new five.Relay(10), '04': new five.Relay(11) } relays.on('value', (snap) => { snap.forEach((lamp) => { lamps[lamp.key()][lamp.val()]() }); }); }); Example
  • 21.