How to use the johnny-five.Thermometer 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 webondevices / js-electronics-book / 02-temperature-sensor / temperature.js View on Github external
arduino.on('ready', function () {
    
    // Access the temperature sensor on pin A0
    var thermometer = new five.Thermometer({
        controller: 'LM35',
        pin: 'A0',
        freq: 1000
    });

    // Data event listener with callback function
    // Will capture incoming sensor readings
    thermometer.on('data', function () {

        // Callback has readings in celsius, fahrenheit and kelvin
        console.log(this.C + '°C');
        console.log(this.F + '°F');
        console.log(this.K + '°K');
        console.log('========');
    });
});
github CommonGarden / Grow-IoT / .examples / arduino / misc / drdose.js View on Github external
board.on('ready', function start() {

  var pH_reading,
    eC_reading,
    data_interval,
    water_temp,
    acidpump = new five.Pin(4),
    basepump = new five.Pin(5),
    ph_power = new five.Pin(12),
    ph_sensor = new five.Sensor('A1');

  // This requires OneWire support using the ConfigurableFirmata
  let thermometer = new five.Thermometer({
    controller: 'DS18B20',
    pin: 3
  });

  thermometer.on('change', function() {
    // console.log(this.celsius + "°C");
    water_temp = this.celsius;
  });

  ph_power.high();

  // Hack: Relays are inversed... make sure pumps are off.
  // Better hardware could take care of this... I'm not an electrical engineer.
  acidpump.high();
  basepump.high();
github sayanee / talks / web-sensors / code / 6-temperature.js View on Github external
five.Board().on('ready', function() {
  var temperature = new five.Thermometer({
    controller: 'LM35',
    pin: 'A0' // Analog pin A0
  })

  temperature.on('data', function() {
    console.log(this.celsius)
    // tip: Too many decimal points? Try Math.round()
    // want to change the temperature? breathe on it!
    // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Math/round

    // tip: Too jittery sensor value?
    // Try a low pass filter / smoothing algorithm / moving average
    // E.g. https://github.com/osuushi/Smooth.js/ or https://www.arduino.cc/en/Tutorial/Smoothing
  })
})
github nebrius / johnny-five-iot-edge / examples / j5-hardware-only / index.js View on Github external
board.on("ready", function() {
  const led = new five.Led("GPIO4");
  const button = new five.Button("GPIO17");
  const temperature = new five.Thermometer({
    controller: "MCP9808"
  });
  const opts = {
    width: 128,
    height: 64,
    address: 0x3C
  };
  const oled = new Oled(board, five, opts);
  const font = require('oled-font-5x7');
  let ledStatus = "on";
  let isMonitoring = true;

  // Turn on LED and set up OLED
  led.on();
  oled.fillRect(1, 1, 128, 64, 0);
  oled.setCursor(1, 1);
github elementumscm / workshop-roboticsjs / examples / temperature / temp.js View on Github external
board.on('ready', () => {

  let temperature = new five.Thermometer({
    controller: 'DS18B20',
    pin: 3,
    freq: 1000
  });

  temperature.on('data', () => {
    console.log(`${temperature.celsius}°C on 0x${temperature.address.toString(16)}`);
  });

});
github AvocadosConstant / fbmessenger-home-automation / arduino / app.js View on Github external
board.on("ready", function() {
  var temperature = new five.Thermometer({
    controller: "MPU6050"
  });

  var button = new five.Button(4);

  board.repl.inject({
    button: button
  });

  button.on("down", function() {
    request.post({url:'https://fb.jagels.us/bot/doorbell', body:'DING DONG!'}, function(err, res, body) {
      if (err) {
        return console.error('Doorbell not acknowledged: ', err);
      }
      console.log('Message sent! Server responded with: ', body);
    });
github fivdi / linux-io / example / chip / i2c-thermometer.js View on Github external
board.on('ready', function() {
  const thermometer = new five.Thermometer({
    controller: 'MCP9808'
  });

  thermometer.on('change', function() {
    console.log('celsius: %d', this.C);
    console.log('fahrenheit: %d', this.F);
    console.log('kelvin: %d', this.K);
  });
});
github zexiplus / WALL.E / server / board / thermometer.js View on Github external
var five = require('johnny-five')
var raspi = require('raspi-io')
var thermometer = {
  controllerName: 'MPU6050',
	instance: new five.Thermometer({
		controller: 'MPU6050'
	}),
	init(client) {
	    var that = this
	    this.instance.on('change',function() {
	        client.emit('changeT',this.celsius)
	    })
	    client.on('updateTemperature',function() {
		    client.emit('changeT',that.instance.celsius)
	    })
	}
}
module.exports = thermometer
github fivdi / linux-io / example / beaglebone-black / i2c-thermometer.js View on Github external
board.on('ready', function() {
  const thermometer = new five.Thermometer({
    controller: 'MCP9808'
  });

  thermometer.on('change', function() {
    console.log('celsius: %d', this.C);
    console.log('fahrenheit: %d', this.F);
    console.log('kelvin: %d', this.K);
  });
});
github tableflip / nodebot-workshop / exercises / remote_temperature / solution / solution.js View on Github external
board.on('ready', function () {
  var sensor = new five.Thermometer({
    controller: 'TMP36',
    pin: 'A0'
  })
  var temp = null

  sensor.on('data', function () {
    temp = this.celsius
  })

  var server = dnode(
    {
      getTemperature: function (cb) {
        cb(temp)
      }
    },
    { weak: false }

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

56 / 100
Full package analysis