How to use the johnny-five.Multi function in johnny-five

To help you get started, we’ve selected a few johnny-five examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ThingLabsIo / IoTLabs / Edison / azure-iot / iot-starter-kit.js View on Github external
board.on('ready', function() {
    console.log('Board connected...');
    
    // Plug the Temperature sensor module
    // into the Grove Shield's I2C jack
    th02 = new five.Multi({
        controller: "TH02"
    });
    
    // Plug the LCD module into any of the
    // Grove Shield's I2C jacks.
    lcd = new five.LCD({
        controller: 'JHD1313M1'
    });
    
    // Plug the LED module into the
    // Grove Shield's D6 jack.
    led = new five.Led(13);
    
    // Plug the Button module into the
    // Grove Shield's D4 jack.
    button = new five.Button(4);
github Azure / connectthedots / Devices / DirectlyConnectedDevices / NodeJS / IntelEdisonXadow / inteledisonctd.js View on Github external
function connect_the_dots()
{
    console.log("Device Ready to connect its dots");
        
    var temp = 25;
    var acc = 0;
    var nbaccmeasures = 0;

    // Initialize temperature sensor
    var multi = new five.Multi({
        controller: "BMP180"
    });
    
    multi.on("change", function() {
        // console.log("BMP180");
        // console.log("  pressure     : ", this.barometer.pressure);
        // console.log("  temperature  : ", this.temperature.celsius)
        // console.log("--------------------------------------");
        temp = this.temperature.celsius;
        // var currentTime = new Date().toISOString();
        // send_message(format_sensor_data(settings.guid1, settings.displayname, settings.organization, settings.location, "Temperature", "C", currentTime , this.temperature.celsius), currentTime);
    
    });
    
    // Initialize accelerometer    
    var accelerometer = new five.Accelerometer({
github CommonGarden / Grow-IoT / drivers / Raspberry-Pi / grow-hub.js View on Github external
token: 'xsG6G5PyQMKPycWN5AjZvuSD2K4GmMcn',
    component: 'grow-hub',

    // Properties can be updated by the API
    properties: {
      state: null,
      duration: 2000,
      interval: 5000,
      targets: {},
    },

    light: new five.Light({
      controller: 'TSL2561'
    }),

    multi: new five.Multi({
      controller: 'SI7020'
    }),

    start: function () {
      console.log('Grow-Hub initialized.');

      // This must be called prior to any I2C reads or writes.
      // See Johnny-Five docs: http://johnny-five.io
      board.i2cConfig();

      board.i2cRead(0x64, 32, function (bytes) {
        var bytelist = [];
        if (bytes[0] === 1) {
          for (i = 0; i < bytes.length; i++) {
            if (bytes[i] !== 1 && bytes[i] !== 0) {
              bytelist.push(ascii.symbolForDecimal(bytes[i]));
github stevekinney / nodebots-workshop / example-code / 04-weather-station / 02-weather-to-cli.js View on Github external
board.on('ready', () => {
  const monitor = new five.Multi({
    controller: 'BME280',
  });

  // More code here!
});
github CommonGarden / Grow-IoT / .examples / rasp-pi / bme280.js View on Github external
board.on('ready', function start() {
  // Declare needed variables.
  var emit_data;

  var multi = new five.Multi({
    controller: 'BME280'
  });

  var growHub = new Grow({
    uuid: '732db76b-7d92-4c6c-995f-ec0d34acf6f2',
    token: '5qL8nsFpqDf7m4cY9u6uFoXDKMfGJHf2',

    component: 'ClimateSensor',

    properties: {
      interval: 6000,
      growfile: {
        targets: {
          temperature: {
            min: 10,
            max: 25
github CommonGarden / Grow-IoT / .examples / rasp-pi / plusfarm.js View on Github external
board.on('ready', function start() {
  // Declare needed variables.
  var pH_reading, eC_reading, water_temp, emit_data;

  var floatSwitch = new five.Pin('P1-7');

  var multi = new five.Multi({
    controller: 'BME280'
  });

  // var lux = new five.Light({
  //   controller: 'TSL2561'
  // });

  var plusfarm = new Grow({
    uuid: 'meow',
    token: 'meow',
    component: 'PlusFarm',

    properties: {
      light_state: null,
      pump_state: null,
      water_level: null,
github stevekinney / nodebots-workshop / example-code / 04-weather-station / 04-weather-to-web.js View on Github external
board.on('ready', () => {
  const monitor = new five.Multi({
    controller: 'BME280',
  });

  const handleChange = throttle(() => {
    const temperature = monitor.thermometer.fahrenheit;
    const pressure = monitor.barometer.pressure;
    const relativeHumidity = monitor.hygrometer.relativeHumidity;

    // Our code here!
  }, 1000);

  monitor.on('change', handleChange);
});
github lyzadanger / javascript-on-things / chapter-08 / 04-t2-weather / index.js View on Github external
board.on('ready', () => {
  const weatherSensor = new five.Multi({
    controller: 'BMP180',
    freq: 5000
  });

  socket.on('connection', client => {
    weatherSensor.on('change', () => {
      client.emit('weather', {
        temperature: weatherSensor.thermometer.F,
        pressure: (weatherSensor.barometer.pressure * 10)
      });
    });
  });

  server.listen(3000, () => {
    console.log(`http://${os.networkInterfaces().wlan0[0].address}:3000`);
  });
github peerigon / talks / 2017-02-07-web-and-wine-js-on-hardware / demo / dashboard / server.js View on Github external
board.on("ready", function() {
    
    const multi = new five.Multi({
        controller: "MPL3115A2",
        elevation: 492
    });
    
    multi.on("change", function() {
        currentTemperature = this.temperature.celsius;
        console.log(this.temperature.celsius, this.barometer.pressure, this.altimeter.meters);
        
        wsBroadcast({
            temperature: this.temperature.celsius,
            ts: Date.now()
        });
    });
    
    multi.on("error", console.error);
});
github stevekinney / nodebots-workshop / example-code / 04-weather-station / 03-socket-weather / index.js View on Github external
board.on('ready', () => {
  const express = require('express');
  const app = express();
  const http = require('http').Server(app);
  const io = require('socket.io')(http);
  const port = process.env.PORT || 80;

  app.use(express.static(path.join(__dirname, 'public')));

  app.get('/', function(req, res) {
    res.sendFile(path.join(__dirname, '/public/index.html'));
  });

  const monitor = new five.Multi({
    controller: 'BME280',
  });

  const handleChange = throttle(() => {
    const temperature = monitor.thermometer.fahrenheit;
    const pressure = monitor.barometer.pressure;
    const relativeHumidity = monitor.hygrometer.relativeHumidity;

    io.sockets.emit('weather updated', {
      temperature,
      pressure,
      relativeHumidity,
    });
  }, 500);

  monitor.on('change', handleChange);

johnny-five

The JavaScript Robotics and Hardware Programming Framework. Use with: Arduino (all models), Electric Imp, Beagle Bone, Intel Galileo & Edison, Linino One, Pinoccio, pcDuino3, Raspberry Pi, Particle/Spark Core & Photon, Tessel 2, TI Launchpad and more!

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis