Hi everyone. I am very new to the Arduino world and have been doing some various practice projects either virtually via Tinkercad or physically with an Arduino Uno R3. I came across a bit of code from a YouTube video where the person in the video created a candle flickering effect. I have my R3 connected to my breadboard and I am using 220 ohm resistors for each LED. When the sketch runs on the r3 i get the flickering like he does in the video however its only one led thats flickering out of the three and id like all 3 to flicker at the same time with the same random pattern. Based off the code it seems they should be doing this but maybe I am missing something and was hoping someone could point out why only one led would be flickering and the other two are staying on solid. Specifically the LED connected to pin 11 is the one flickering and pins 12 and 13 are staying solid. My code is below. I appreciate any help you can provide.
Wow I completely overlooked the fact that the pins I had them in weren't PWM. Once I switched them they are all blinking now, thank you. They still aren't all following the same random blink pattern simultaneously though. They are all blinking randomly however at different intervals. I'd like for the random blinks to sync up across all of the bulbs. How would I go about accomplishing that without having all of the bulbs on the same rail of the breadboard?
yes exactly. Basically what I am trying to accomplish is the look of a light that is flickering sort of like you would see in a horror movie if that makes sense.
correct. Its more the effect I am going for than the color at this point. I think the random effect that I have working now fits what I want but I want to be able to control several LED's as you mentioned where the same random number is being written to each of the LED's at the same time so they achieve the same blinking pattern across all LED's simultaneously. With them flashing how they are now where each LED is getting a different random number than the others they don't flicker in unison and therefore look more like a candle, which based on the code I found in the YouTube video makes sense, but I wanted to try to build off of that to get more of a shorting light effect. If you've ever seen what a fluorescent bulb does when the ballast running it is going bad that's the kind of flicker I am going for.
thats the thing i am not sure how to approach making them flicker together and receive the same random number so they are all flickering the same. right now there are instances where one is on and another is off then they may be both on at the same time or one dims a bit and the other blinks at a faster rate. I want all of them to blink at the same rate so the effect is uniform across all of them led's. I did find something doing a bit of googling that it isnt possible to apply analogWrite to multiple pins at the same time. Is that true?