I have a question regarding the use of SevSegShift library. I followed the example properly and tested it to see if it works. It was able to power up the seven segments and light up the whole LEDs (even the decimal) but it's not showing the output I want to show.
Based on the code below, I want to show the number 500 but it does not. Even tried sevsegshift.setChars("abcd")
, no change.
This is my code:
#include <SevSegShift.h>
#define SHIFT_PIN_SHCP 6
#define SHIFT_PIN_STCP 5
#define SHIFT_PIN_DS 4
SevSegShift sevseg(SHIFT_PIN_DS, SHIFT_PIN_SHCP, SHIFT_PIN_STCP, 1, true);
void setup() {
byte numDigits = 4;
byte digitPins[] = {9, 10, 11, 12}; // These are the PINS of the ** Arduino **
byte segmentPins[] = {0, 1, 2, 3, 4, 5, 6, 7}; // these are the PINs of the ** Shift register **
bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
byte hardwareConfig = COMMON_CATHODE; // See README.md for options
bool updateWithDelays = false; // Default 'false' is Recommended
bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
bool disableDecPoint = true; // Use 'true' if your decimal point doesn't exist or isn't connected
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, updateWithDelays, leadingZeros, disableDecPoint);
sevseg.setBrightness(10);
}
void loop() {
sevseg.setNumber(500);
//delay(1000);
sevseg.refreshDisplay(); // Must run repeatedly; don't use blocking code (ex: delay()) in the loop() function or this won't work right
}
This is my breadboard schematic down below.
(220 ohm resistors on the digit pins and the segment pins are connected to the shift register)
delay()
and one line above you use delay(). Hmmm, possibly ?! The shift register must be update very fast i guess.delay()
and still the same output :(