Use the board's samplingInterval(ms) to control the actual MCU sampling rate.

Breadboard for "Board - Specify Sampling Interval"

board-sampling-interval.png

 

Run this example from the command line with:

node eg/board-sampling-interval.js
const { Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {

  // Use the board's `samplingInterval(ms)` to
  // control the actual MCU sampling rate.
  //
  // This will limit sampling of all Analog Input
  // and I2C sensors to once per second (1000 milliseconds)
  board.samplingInterval(1000);


  // Keep in mind that calling this method
  // will ALWAYS OVERRIDE any per-sensor
  // interval/rate/frequency settings.
});

 

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