Skip to content

Latest commit

 

History

History
77 lines (41 loc) · 1.06 KB

shift-register.md

File metadata and controls

77 lines (41 loc) · 1.06 KB

Shift Register

Breadboard for "Shift Register"

docs/breadboard/shift-register.png

Fritzing diagram: docs/breadboard/shift-register.fzz

 

Run this example from the command line with:

node eg/shift-register.js
const {Board, ShiftRegister} = require("johnny-five");
const board = new Board();

// For use with 74HC595 chip

board.on("ready", () => {
  const register = new ShiftRegister({
    pins: {
      data: 2,
      clock: 3,
      latch: 4
    }
  });

  let value = 0b00000000;
  let upper = 0b10001000;
  let lower = 0b00010001;

  function next() {
    register.send(value = value > lower ? value >> 1 : upper);
    setTimeout(next, 200);
  }

  next();
});

 

License

Copyright (c) 2012-2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2015-2023 The Johnny-Five Contributors Licensed under the MIT license.