74HC595 Shift Register
Posted: Tue Dec 11, 2018 3:48 am
Hi All,
I am currently trying to control a TI 74HC595 Shift register using my ESP32 DevKit C. I think my problem seems to do with the data stream or clock rate. I try and turn a single output on and off in a loop and the high bit takes up 3 outputs and rather than turn off, it shifts the bit down a few pins.
So in goes: LEDs 1-3 are on for 2 seconds, then LEDs 3-5 are on, then LEDs 5-7 are on. This code worked fine on an Arduino Uno. Any help would be appreciated! shift register library is included.
I am currently trying to control a TI 74HC595 Shift register using my ESP32 DevKit C. I think my problem seems to do with the data stream or clock rate. I try and turn a single output on and off in a loop and the high bit takes up 3 outputs and rather than turn off, it shifts the bit down a few pins.
Code: Select all
#include <Wire.h>
#include <MultiShiftRegister.h>
const int latchPin = 12; //ESP32 Pin 12
const int clockPin = 14; //ESP32 Pin 14
const int dataPin = 27; //ESP32 Pin 27
MultiShiftRegister msr (1, latchPin, clockPin, dataPin);
void setup() {
Serial.begin(9600);
pinMode(latchPin, OUTPUT); //Setting Pin Orientation
pinMode(clockPin, OUTPUT); //Setting Pin Orientation
pinMode(dataPin, OUTPUT); //Setting Pin Orientation
delay(500);
}
void loop() {
msr.set_shift(1);
delay(2000);
msr.clear_shift(1);
delay(2000);