ShiftRegister - lyzadanger/johnny-five GitHub Wiki

The ShiftRegister class constructs an object that represents a shift register.

Parameters

  • options An object of property parameters
Property Name Type Value(s) Description Required
pins Object ``` { data: 2, clock: 3, latch: 4 } ``` Sets the values of the data , clock and latch pins yes
  • pins
    Property Name Type Value(s) Description Required
    data Number Any pin on board Sets the pin corresponding to the shiftregisters's data pin yes
    clock Number Any pin on board Sets the pin corresponding to the shiftregisters's clock pin yes
    latch Number Any pin on board Sets the pin corresponding to the shiftregisters's latch pin yes

Shape

{
  pins : the object containing the pin values for data, clock and latch 
}

Usage

var five = require("johnny-five"),
    board, shiftRegister;

board = new five.Board();

board.on("ready", function() {
  shiftRegister = new five.ShiftRegister({
    pins: {
      data: 2,
      clock: 3,
      latch: 4
    }
  });

});

API

  • send(value) send a value to the shiftregister
    shiftRegister = new five.ShiftRegister({
      pins: {
        data: 2,
        clock: 3,
        latch: 4
      }
    });
    
    var value = 0;
    
    shiftRegister.send( 0x11 );    

Events

Shiftregisters do not emit any events.

Examples

⚠️ **GitHub.com Fallback** ⚠️