Skip to content

Latest commit

 

History

History
74 lines (37 loc) · 1.08 KB

sensor-fsr.md

File metadata and controls

74 lines (37 loc) · 1.08 KB

Sensor - Force sensitive resistor

Breadboard for "Sensor - Force sensitive resistor"

docs/breadboard/sensor-fsr.png

Fritzing diagram: docs/breadboard/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);
  });
});

 

License

Copyright (c) 2012-2014 Rick Waldron [email protected] Licensed under the MIT license. Copyright (c) 2015-2023 The Johnny-Five Contributors Licensed under the MIT license.