Hey guys,
New to the forums/arduino/EE, but having a blast!
Currently I am trying to control two RGB LED strips with an ATTiny85 microcontroller that I programmed with an Arduino Uno. The program I have basically fades the two LED strips between blue and white.
Code:
#define REDPIN 1
#define GREENPIN 4
#define BLUEPIN 0
#define FADESPEED 2
int r, g, b;
void setup() {
pinMode(REDPIN, OUTPUT);
pinMode(GREENPIN, OUTPUT);
pinMode(BLUEPIN, OUTPUT);
}
void loop() {
blueWhiteBlueFade();
}
void blueWhiteBlueFade() {
blueFade();
whiteFade();
}
void blueFade() {
for (b = 5; b < 256 ; b++) {
analogWrite(BLUEPIN, b);
delay(FADESPEED);
}
for (b = 255; b > 5; b--) {
analogWrite(BLUEPIN, b);
delay(FADESPEED);
}
}
void whiteFade() {
for (b = 5; b < 256 ; b++) {
analogWrite(BLUEPIN, b);
analogWrite(REDPIN, b);
analogWrite(GREENPIN, b);
delay(FADESPEED);
}
for (b = 255; b > 5; b--) {
analogWrite(BLUEPIN, b);
analogWrite(REDPIN, b);
analogWrite(GREENPIN, b);
delay(FADESPEED);
}
}
This works perfectly fine while hooked up to the Arduino and a breadboard. It also works perfectly fine with a single 4-leg RGB LED with the ATTiny85 with the previous code loaded on it.
Everything seems to fall apart when I try to control the two LED strips with the ATTiny85 and a ULN2803APG. The strips light up, and they do a bit of quick color flickering, but it doesn't fade out and are quite bright. This may be because the LED strips are getting power directly from the +12V power source.
As I'm new to this I assume there is quite a big problem with my circuit. Can anyone please take a look at my circuit and point me in to the right direction? It is attached.
Thanks so much!