Arduino RGB Blinker

Schaltung folgt irgendwann :>

Arduino RGB Zufallsblinker neverending
// int pins + variable int LED1 = 10; int LED2 = 11; int LED3 = 12; int LED4 = 13; int LED5 = 6; int LED6 = 7; int LED7 = 8; int LED8 = 9; int rgb;

void setup { pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); pinMode(LED3, OUTPUT); pinMode(LED4, OUTPUT); pinMode(LED5, OUTPUT); pinMode(LED6, OUTPUT); pinMode(LED7, OUTPUT); pinMode(LED8, OUTPUT); }

void loop { rgb = (random (1, 7)); // random rgb 1-7 // rgb = (0); switch (rgb)        // switch rgb 1--7 farbwert { case 1: // gelb digitalWrite(LED1,HIGH); digitalWrite(LED2,LOW); digitalWrite(LED3,HIGH); digitalWrite(LED4,LOW); digitalWrite(LED5,HIGH); digitalWrite(LED6,LOW); digitalWrite(LED7,HIGH); digitalWrite(LED8,LOW);

delay(random (50, 250) ); // delay variabel //delay(1000)              // delay 1 sec break; case 2: //lila digitalWrite(LED1,LOW); digitalWrite(LED2,HIGH); digitalWrite(LED3,HIGH); digitalWrite(LED4,LOW); digitalWrite(LED5,LOW); digitalWrite(LED6,HIGH); digitalWrite(LED7,HIGH); digitalWrite(LED8,LOW);

delay(random (50, 250)); break; case 3: // blau digitalWrite(LED1,LOW); digitalWrite(LED2,HIGH); digitalWrite(LED3,HIGH); digitalWrite(LED4,HIGH); digitalWrite(LED5,LOW); digitalWrite(LED6,HIGH); digitalWrite(LED7,HIGH); digitalWrite(LED8,HIGH);

delay(random (50, 250)); break; case 4: // rot digitalWrite(LED1,HIGH); digitalWrite(LED2,HIGH); digitalWrite(LED3,HIGH); digitalWrite(LED4,LOW); digitalWrite(LED5,HIGH); digitalWrite(LED6,HIGH); digitalWrite(LED7,HIGH); digitalWrite(LED8,LOW);

delay(random (50, 250) ); break; case 5: // gruen digitalWrite(LED1,HIGH); digitalWrite(LED2,LOW); digitalWrite(LED3,HIGH); digitalWrite(LED4,HIGH); digitalWrite(LED5,HIGH); digitalWrite(LED6,LOW); digitalWrite(LED7,HIGH); digitalWrite(LED8,HIGH); break; case 6: // tuerkis digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); digitalWrite(LED3,HIGH); digitalWrite(LED4,HIGH); digitalWrite(LED5,LOW); digitalWrite(LED6,LOW); digitalWrite(LED7,HIGH); digitalWrite(LED8,HIGH);

delay(random (50, 250) ); break; case 7: //weiss digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); digitalWrite(LED3,HIGH); digitalWrite(LED4,LOW); digitalWrite(LED5,LOW); digitalWrite(LED6,LOW); digitalWrite(LED7,HIGH); digitalWrite(LED8,LOW);

delay(random (50, 250)); break; default: //off digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); digitalWrite(LED3,LOW); digitalWrite(LED4,LOW); digitalWrite(LED5,LOW); digitalWrite(LED6,LOW); digitalWrite(LED7,LOW); digitalWrite(LED8,LOW);

delay(random (50, 250)); } }