Hi, so I'm pretty new to Arduino and electronics in overall, I did some simpler projects and now I wanted something more sophistocated. So I run out of pins, so I decided to use shift register. And here my problem begun...
14 lipca 2021 - YouTube - this is how it looks like, in real life it isnt't that noticable, for long time I was wondering if it's really flickering or it's just delusion.
As far as I read max is 70mA, I'm using 1.2k resistors, so with yellow LEDs it's around 2mA for single LED, so 16mA for all LEDs, it should be ok. Please correct me if I'm wrong, never before had I do such calculations. I was using tutorials most of the time, so I didn't need to think about voltage, ohms, etc...
https://i.imgur.com/pekC6yb.png - that's my schematic.
And that's my code. I know it can be much simpler, but so far I took it from net tutorial.
#include <Arduino.h>
byte SER = 11;
byte RCLK = 12;
byte SRCLK = 13;
byte pins[8];
void clear() {
for (int i = 0; i < 8; i++) {
pins[i] = LOW;
}
}
void save() {
digitalWrite(RCLK, LOW);
for (int i = 7; i >= 0; i--) {
Serial.println(pins[i]);
digitalWrite(SRCLK, LOW);
digitalWrite(SER, pins[i]);
digitalWrite(SRCLK, HIGH);
}
digitalWrite(RCLK, HIGH);
}
void set(int index, int value) {
pins[index] = value;
}
void setup() {
Serial.begin(9600);
pinMode(SER, OUTPUT);
pinMode(RCLK, OUTPUT);
pinMode(SRCLK, OUTPUT);
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
clear();
save();
for (int i = 0; i < 8; i++) {
set(i, HIGH);
}
save();
}
void loop() {
}
The only thing I found on the internet, some people suggested using capacitors between Vcc and GND, but I don't have any and buying them is not so easy for me - either online shop or long ride to quite far away stationary shop. I wouldn't be happy if I lost this time (or money for shipping) and it won't give anything, as perhaps my problems is different and capacitors won't fix it...