/*
Arduino | general
Piloto — 11/8/24 at 9:48 PM
Can someome help me with this weird effect that
is happening with my RGB LEDs?
Resistors are needed on each LED so one doesn't "hog" the current.
Transistors are needed on all the "COM" pins because if you go
full white they would need to supply 30mA, exceeding the pins
capability.
*/
const int LED_COM_PINS[] = {13, 12, 11, 10, 9, 8};
const int RGB_PINS[] = {3, 5, 6};
void setup() {
Serial.begin(115200);
for (int com = 0; com < 6; com++) {
pinMode(LED_COM_PINS[com], OUTPUT);
digitalWrite(LED_COM_PINS[com], LOW);
}
for (int color = 0; color < 3; color++) {
pinMode(RGB_PINS[color], OUTPUT);
digitalWrite(RGB_PINS[color], HIGH);
}
Serial.println("Start\n");
}
void loop() {
for (int i = 0; i < 6; i++) {
Serial.print("Com: ");
Serial.println(i);
digitalWrite(LED_COM_PINS[i], HIGH);
for (int j = 0; j < 3; j++) {
Serial.print("Color: ");
Serial.println(j);
analogWrite(RGB_PINS[j], 0);
delay(1000);
analogWrite(RGB_PINS[j], 255);
}
digitalWrite(LED_COM_PINS[i], LOW);
}
}