How to use the johnny-five.Led 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 / Photon / Lab06 / lab06_light.js View on Github external
board.on("ready", function() {
        console.log("Board connected...");
           
        // Initialize the LED
        led = new five.Led(LEDPIN);
   
        // Inject the `sensor` hardware into the Repl instance's context;
        // Allows direct command line access
        board.repl.inject({
            led:led
        });
    });
});
github SaraJo / build-brite / index.js View on Github external
board.on('ready', function (){
  // Create three instances of LEDs
  red = new j5.Led({pin : 11});
  green = new j5.Led({pin : 10});
  blue = new j5.Led({pin: 9});

  if(config.ledType === "common-anode") {
    swapOffOn(red);
    swapOffOn(blue);
    swapOffOn(green);
  }

  setInterval(getStatus, 500);
});
github SaraJo / build-brite / index.js View on Github external
board.on('ready', function (){
  // Create three instances of LEDs
  red = new j5.Led({pin : 11});
  green = new j5.Led({pin : 10});
  blue = new j5.Led({pin: 9});

  if(config.ledType === "common-anode") {
    swapOffOn(red);
    swapOffOn(blue);
    swapOffOn(green);
  }

  setInterval(getStatus, 500);
});
github ThingLabsIo / IoTLabs / Edison / azure-iot / iot-starter-kit.js View on Github external
// 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);
    
    
    
    // *********************************************
    // The thermometer object will invoke a callback
    // everytime it reads data as fast as every 25ms
    // or whatever the 'freq' argument is set to.
    // *********************************************
    th02.on('data', function() {
        // Set the state of the variables based on the 
        // value read from the thermometer
        // 'this' scope is the thermometer
github nodebotsau / simplebot / examples / motors.js View on Github external
pins: {
            pwm: 9,
            dir: 8,
        },
        invertPWM: true,
    });

    motor_l = new five.Motor({
        pins: {
            pwm: 6,
            dir: 7,
        },
        invertPWM: true,
    });

    led = new five.Led(11);

    console.info("Robot running issue commands to it.");
    console.info("LRUD arrows. Space stop. Q to quit");

});
github rwaldron / johnny-five / eg / arduino-starter-kit / knock-lock.js View on Github external
board.on("ready", function() {
  var piezo = new five.Sensor({
    pin: "A0",
    threshold: 10
  });
  piezo.on("change", function() {
    box.knock(this.value);
  });
  var button = new five.Button(2);
  button.on("press", function() {
    box.lock();
  });

  var yellow = new five.Led(3);
  var green = new five.Led(4);
  var red = new five.Led(5);
  var servo = new five.Servo(9);
  var box = new Box(servo, red, green, yellow);
});
github firmata / firmata.js / examples / johnny-five-io-plugin.js View on Github external
board.on("ready", () => {
    const led = new five.Led(13);
    led.blink(500);
  });
});
github sofroniewn / electron-johnny-five-examples / 2-switch / app / index.js View on Github external
board.on('ready', function() {
  document.getElementById('board-status').src = 'icons/ready.png'
  var led = new five.Led(12)
  var spdt = new five.Switch(9)

  spdt.on('open', function() {
    led.off()
    document.getElementById('led-status').src = 'icons/led-off.png'
  })

  spdt.on('close', function() {
    led.on()
    document.getElementById('led-status').src = 'icons/led-on.png'
  })
})
github sofroniewn / electron-johnny-five-examples / 1-led / app / index.js View on Github external
board.on('ready', function() {
  document.getElementById('board-status').src = 'icons/ready.png'
  button.className = 'button'
  var led = new five.Led(12)
  
  button.addEventListener('click', function () {
    state = !state
    if (state) {
      document.getElementById('led-status').src = 'icons/led-on.png'
      led.on()
    }
    else {
      document.getElementById('led-status').src = 'icons/led-off.png'
      led.off()
    }
  })
})
github mimming / snippets / nodebotyay / firebase.js View on Github external
board.on("ready", function() {

  button = new five.Button(8);
  var led = new five.Led(7);

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

  button.on("down", function() {
    buttonRef.set("down");
  });

  button.on("up", function() {
    buttonRef.set("up");
  });


  buttonRef.on("value", function(snapshot) {

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