Good evening,
I need to control 7segment display with 74hc595 IC.
I tested the code with 7 LEDs and 74hc595 IC, it's working correctly.
I tested the 7segments directly connected to Arduino and it's working correctly.
When I integrate the shift register and the the 7 segments, three segments are continuously ON regardless of the value of the shift register.
I am using 8 10k resistors for the LEDs segments,
when I checked some videos online, I saw that they are using only one resistor ?
how to proceed ?
/Pin connected to ST_CP of 74HC595
#define DS_PIN A4 // data
#define STCP_PIN A3 // storage register clock //////// latch pin
#define SHCP_PIN A2 // shift register clock ///////// clockpin
void setup() {
//set pins to output so you can control the shift register
pinMode(STCP_PIN, OUTPUT);
pinMode(SHCP_PIN, OUTPUT);
pinMode(DS_PIN, OUTPUT);
}
void loop() {
// count from 0 to 255 and display the number
// on the LEDs
//for (int numberToDisplay = 0; numberToDisplay < 256; numberToDisplay++) {
// take the latchPin low so
// the LEDs don't change while you're sending in bits:
int numberToDisplay = 7;
digitalWrite(STCP_PIN, LOW);
// shift out the bits:
shiftOut(DS_PIN, SHCP_PIN, MSBFIRST, numberToDisplay);
//take the latch pin high so the LEDs will light up:
digitalWrite(STCP_PIN, HIGH);
// pause before next value:1
delay(1000);
//}
}