rpio-shift
Control shift-registers from your Rasberry Pi Using JavaScript!
const rpio = ;const ShiftRegister = ; // To control a shift register from the pi itselfconst sr = // pins: [data, clk, outputLatch] pins: 11 12 13 // How many shift registers you're chaining defaults to 1 registers: 2 // sr.write(outputPin, state)// outputPin can be any int from 0 to 7// state can be 0 or 1 (rpio.LOW or rpio.HIGH)sr; // Turn on the first output pinsr; // Turn off the last output pin// If you have multiple shift-registers in a chain, pin 0 is the first output pin in the last shift-register in the chain, pin 8 is the first output pin in the second-last shift-register in the chain, and so on // sr.writeState(values);// Sets the state of all the pins in a shift-register chainsr; // Turn off all outputssr; // Turn off pins 0-3, turn on pins 4-7sr; // Don't change the state of pin 0, turn on pin 1, turn off pin 2, don't change the state of other pinssr; // Turn on all pins on the last shift-register, turn off all pins on the first shift-registersr // Turn on the 29th pin in the chain. (Using bigints) // sr.writeByte(values);// Takes an 8 bit uint or an array of states// Do not use this function if you're chaining multiple shift-registers. Use writeState instead.sr; // Turn off all outputssr; // Turn off pins 0-3, turn on pins 4-7sr; // Don't change the state of pin 0, turn on pin 1, turn off pin 2, don't change the state of other pins // To control a shift register from another shift registerconst sr2 = pins: 5 6 7 io: sr sr sr;