How to use the johnny-five.Pin 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 CommonGarden / Grow-IoT / packages / Grow.js / examples / rasp-pi / bioreactor.js View on Github external
nano.on('ready', function start() {
    // Define variables
    heater = new five.Pin(6);
    airlift = new five.Pin(7);
    aerator = new five.Pin(8);
    water_pump = new five.Pin(9);
    level = new five.Sensor('A3');
    level_ref = new five.Sensor('A2');

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

    thermometer.on('change', function() {
        try {
            water_temp = this.celsius;
        } catch(err) {
            console.log(err);
        }
    });
github elementumscm / workshop-roboticsjs / examples / joystick / joystick.js View on Github external
board.on('ready', function() {

  // Create a new `nunchuk` hardware instance.
  const nunchuk = new five.Wii.Nunchuk({
    freq: 50
  });

  new five.Pin("A2").low();
  new five.Pin("A3").high();

  nunchuk.joystick.on('change', function(event) {
    console.log(
      'joystick ' + event.axis,
      event.target[event.axis],
      event.axis, event.direction
    );
  });

  nunchuk.accelerometer.on('change', function(event) {
    console.log(
      'accelerometer ' + event.axis,
      event.target[event.axis],
      event.axis, event.direction
    );
  });
github intel / intel-iot-services-orchestration-layer / node_modules / hope-demo / lattepanda / init.js View on Github external
function setAnalog(params){

  // parse params, params[0] should be "set_analog"
  var pinNumber = params[1],
    pinVal    = params[2];

  if (pinWrites[pinNumber] == null) {
    log("creating new pin " + pinNumber);
    try{
      var pin = new five.Pin(pinNumber);
      pinWrites[pinNumber] = pin;
      _registerPinRead(pin);
      
    } catch (err) {
      dir(err);
      log(err.stack.split("\n"));
    }
  }
  
  dir(pinWrites[pinNumber]);

  log("set analog pinNumber %s, pinVal %d", pinNumber, pinVal);

  pinWrites[pinNumber].write(pinVal);
  pinReads[pinNumber] = pinVal;
github CommonGarden / Grow-IoT / imports / ui / bower_components / dr-dose / drivers / Raspberry-Pi / dr_dose_with_http_server.js View on Github external
board.on('ready', function start() {
    var pH_reading,
        pH_readings = [],
        eC_reading,
        eC_readings = [];
       var acidpump = new five.Pin('P1-11'),
        basepump = new five.Pin('P1-12'),
        nutrientpump = new five.Pin('P1-13');

    // 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();
    nutrientpump.high();

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

    // Create a new theDr instance and connect to https://theDr.commongarden.org
    var theDr = new GrowInstance({
        uuid: '04b19f61-adcf-4763-b2e1-a8bf93447970',
        token: 'hQ5Svts8DJkqrcBT4W6aCxFxy9hWy5dT',
        webcomponent: 'dr-dose',
github CommonGarden / Grow-IoT / examples / arduino / DrDose / drDose.js View on Github external
board.on('ready', function start() {
    // Declare variables and pins
    var pH_reading;
    var pH_readings = [];
    var circpump = new five.Pin(10);
    var acidpump = new five.Pin(11);
    var basepump = new five.Pin(12);

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

    // Create a new grow instance. Connects by default to localhost:3000
    // Create a new grow instance.
    var grow = new GrowInstance({
        name: 'Dr. Dose', // The display name for the thing.
        desription: 'Dr. Dose keeps your pH balanced.',

        // The username of the account you want this device to be added to.
        username: 'jake2@gmail.com',

        // Properties can be updated by the API
        properties: {
github CommonGarden / Grow-IoT / .examples / rasp-pi / bioreactor2.js View on Github external
board.on('ready', function start() {

  	// Define variables
  	circ_pump = new five.Pin('GPIO26');
  	doser = new five.Pin('GPIO20');
  	heater = new five.Pin('GPIO21');

    let bioreactor = new Grow({
      uuid: 'meow',
      token: 'meow',
      component: 'BioReactor',
      properties: {
        light_state: null,
        heater: 'off',//1
        circ_pump: 'off',//2
        doser: 'off',//3
        water_level: null,
        duration: 2000,
        interval: 30000,
        threshold: 50,
        growfile: {
          name: 'Yeast',
github CommonGarden / Grow-IoT / imports / ui / bower_components / dr-dose / drivers / Raspberry-Pi / dr_dose_with_http_server.js View on Github external
board.on('ready', function start() {
    var pH_reading,
        pH_readings = [],
        eC_reading,
        eC_readings = [];
       var acidpump = new five.Pin('P1-11'),
        basepump = new five.Pin('P1-12'),
        nutrientpump = new five.Pin('P1-13');

    // 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();
    nutrientpump.high();

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

    // Create a new theDr instance and connect to https://theDr.commongarden.org
    var theDr = new GrowInstance({
        uuid: '04b19f61-adcf-4763-b2e1-a8bf93447970',
        token: 'hQ5Svts8DJkqrcBT4W6aCxFxy9hWy5dT',
github CommonGarden / Grow-IoT / .examples / rasp-pi / nano.js View on Github external
nano.on('ready', function start() {
  // Define variables
  var one = new five.Pin(6),
    two = new five.Pin(7),
    three = new five.Pin(8),
    four = new five.Pin(9);

  one.high();
  two.high();
  three.high();
  four.high();

  // This requires OneWire support using the ConfigurableFirmata
  var thermometer1 = new five.Thermometer({
    controller: "DS18B20",
    pin: 4
  });

  var thermometer2 = new five.Thermometer({
    controller: "DS18B20",
    pin: 5
github CommonGarden / Grow-IoT / packages / Grow.js / examples / rasp-pi / bioreactor.js View on Github external
nano.on('ready', function start() {
    // Define variables
    heater = new five.Pin(6);
    airlift = new five.Pin(7);
    aerator = new five.Pin(8);
    water_pump = new five.Pin(9);
    level = new five.Sensor('A3');
    level_ref = new five.Sensor('A2');

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

    thermometer.on('change', function() {
        try {
            water_temp = this.celsius;
        } catch(err) {
github rwaldron / johnny-five / eg / arduino-starter-kit / motorized-pinwheel.js View on Github external
board.on("ready", function() {
  var gate = new five.Pin(9);
  var button = new five.Button(2);
  button.on("press", function() {
    gate.write(1);
  });
  button.on("release", function() {
    gate.write(0);
  });
});

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