How to use the johnny-five.Temperature 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 / Arduino / Labs05_07 / lab06_temp.js View on Github external
board.on("ready", function() {
        console.log("Board connected...");

        var temperature = new five.Temperature({
            controller: "TMP36",
            pin: "A2",
            freq: 500
        });
    
        // When temperature data is read based on the freq,
        // send a messge to Nitrogen
        temperature.on("data", function(err, data) {

            var c = Math.floor(data.celsius);
      
            // Create a Nitrogen message
            var message = new nitrogen.Message({
                type: 'temperature',
                tags: nitrogen.CommandManager.commandTag('demo_temp'),
                body: {
github Azure / connectthedots / Devices / DirectlyConnectedDevices / NodeJS / BeagleBoneBlack / beagleboneblackctd.js View on Github external
{
    console.log("Device Ready to connect its dots");

    var lght = 0;
    var temp = 25;

    var light = new five.Sensor({
        pin: "A2"    
    });
    
    light.on("change", function() {
        console.log("light: %d", this.value);
        lght = this.value;
    });
    
    var temperature = new five.Temperature({
        controller: "GROVE",
        pin: "A0"    
    });
    
    temperature.on("change", function() {
        console.log("celsius: %d", this.celsius);
        console.log("fahrenheit: %d", this.fahrenheit);
        console.log("kelvin: %d", this.kelvin);
        temp = this.celsius;
    });  
    
    // send data to Azure every 500 milliseconds    
    setInterval(function(){
        connectthedots.send_message("Light", "L", lght);
        connectthedots.send_message("Temp", "C", temp);
    }, 500);
github ThingLabsIo / IoTLabs / Arduino / Labs01_04 / lab03_temp.js View on Github external
board.on("ready", function() {
    console.log("Board connected...");

    var temperature = new five.Temperature({
      controller: "TMP36",
      pin: "A2",
      freq: 500
    });

    led = new five.Led(13);

    var brightness = 0;
    
    temperature.on("data", function(err, data) {
      var c, f;
      
      c = Math.floor(data.celsius);
      f = Math.floor(data.fahrenheit);
      
      console.log(c + "°C", f + "°F");
github Azure-Samples / iot-hub-node-intel-edison-getstartedkit / command_center / command_center.js View on Github external
board.on("ready", function() {
  var temp = new five.Temperature({
    pin: "A0",
    controller: "GROVE"
  });

  var led = new five.Led(8);

  var turnFanOn = function () {
    led.on();
  };

  var turnFanOff = function() {
    led.off();
  };

  var setAirResistance = function(position) {
    console.log("Setting Air Resistance Position to " + position);
github Azure-Samples / iot-hub-node-intel-edison-getstartedkit / remote_monitoring / remote_monitoring.js View on Github external
board.on("ready", function() {
  var temp = new five.Temperature({
    pin: "A0",
    controller: "GROVE"
  });

  client.open(function (err, result) {
    if (err) {
      printErrorFor('open')(err);
    } else {
      console.log('Sending device metadata:\n' + JSON.stringify(deviceMetaData));
      client.sendEvent(new Message(JSON.stringify(deviceMetaData)), printErrorFor('send metadata'));

      client.on('message', function (msg) {
        console.log('receive data: ' + msg.getData());

        try {
          var command = JSON.parse(msg.getData());
github w4ilun / edison-guides / recipies / Johnny-Five Examples / temperature.js View on Github external
board.on("ready", function() {
  var temp = new five.Temperature({
    pin: "A0",
    controller: "GROVE"
  });

  this.loop(2000, function() {
    console.log("%d°C", Math.round(temp.celsius));
  });
});
github AnnaGerber / node-ardx / code / CIRC10-code-temperaturesensor.js View on Github external
board.on("ready", function() {
  var temp = new five.Temperature({
    pin: "A0",
    controller: "TMP36"
  });

  temp.on("change", function() {
    console.log("Temp: %d", this.celsius);
  });
});

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