The code is really simple, and it’s read as follows:
int SER =8;
int LATCH =9;
int CLK =10;
void setup()
{
pinMode(SER, OUTPUT);
pinMode(LATCH, OUTPUT);
pinMode(CLK, OUTPUT);
digitalWrite(LATCH, LOW);
shiftOut(SER, CLK, MSBFIRST, B10101010);
digitalWrite(LATCH, HIGH);
}
void loop(){}
The problem is that no matter what Number I send to the shift register, either integer or binary, the 8 LEDs glow constantly when arduino is connected. Even if there’s no code, just plugging-in the arduino is sufficient to glow every single LED. This seems quite weird to me, I’ve already checked all my connections, and it looks everything is fine.
Oh I see, thank you, I’ll try it tomorrow after buying one because unfortunately I don’t have any capacitor.
Anyway, in what sense the 1k resistor changes could be a good idea? I thought a 220Ω resistor was quite enough to current-limit the 2-3 V LEDs.
Actually, I have a 470 μF capacitor, would it work?
I you are serious in learning this stuff and you want to properly communicate with people about your project, you need to learn to post a proper schematic of the circuit you are referring to.
Hi,
this is your code.
I made a small change to it just to give it "movement".
It works correctly.
I see some possibilities:
Or, as already mentioned, the lack of capacitors is proving failures;
or you connected something wrong in your assembly;
or your 74HC595 is faulty.
Thank you so much guys.
LarryD thank you, I supposed it wasn’t the best option but I though it was better than posting a photo of my actual wiring. What software would you recommend me for making my own schematics?
Also, I know there are several programs that help you simulating the behaviour of your circuits, do you know some I could start with?
Updating:
I replaced 220Ω resistors by 1K, also added the 0.1μF de-coupling capacitor (ceramic) as you told me.
It’s acting the same way. Just a lower bright of the LEDs.
If your problem was solved, do a kindness to everyone on the forum, especially to those who helped you.
Write [Solved] before your topic title, so if someone searches and finds your topic, they'll know what the solution looks like.
And if it was solved by some help, please tick the one that best describes your solution.