Breadboard for "Sensor - Force sensitive resistor"

sensor-fsr.png

Fritzing diagram: sensor-fsr.fzz

 

Run this example from the command line with:

node eg/sensor-fsr.js
var five = require("johnny-five"),
  fsr, led;

(new five.Board()).on("ready", function() {

  // Create a new `fsr` hardware instance.
  fsr = new five.Sensor({
    pin: "A0",
    freq: 25
  });

  led = new five.Led(9);

  // Scale the sensor's value to the LED's brightness range
  fsr.scale([0, 255]).on("data", function() {

    // set the led's brightness based on force
    // applied to force sensitive resistor

    led.brightness(this.scaled);
  });
});

 

Component Classes in this example:

Hi! The Johnny-Five community is building new projects every day. We made this newsletter to tell you about what's new, what's good, and what's next for Open Source robotics. Join us in exploring what we can make together.

Fork me on GitHub