JohnHack
Published © CC BY-NC-ND

Blink Blonk

6 LEDs flash randomly.

BeginnerProtip3
Blink Blonk

Things used in this project

Hardware components

5 mm LED: Yellow
5 mm LED: Yellow
×3
LED, Blue Green
LED, Blue Green
×3
Resistor 220 ohm
Resistor 220 ohm
×1

Story

Read more

Schematics

img_2367_VwgvnKaRrB.JPG

Code

tilfeldig_blink.ino

Assembly x86
int reply3;
int reply4;
int reply5;
int reply6;
int reply7;
int reply8;



void setup() {
  // put your setup code here, to run once:
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
 reply3 = random (2);
 reply4 = random (2);
 reply5 = random (2);
 reply6 = random (2);
 reply7 = random (2);
 reply8 = random (2);

switch(reply3){
   case 0:
   digitalWrite(3,HIGH);
   break;
   case 1:
   digitalWrite(3,LOW);
   break;
}
switch(reply4){
   case 0:
   digitalWrite(4,HIGH);
   break;
   case 1:
   digitalWrite(4,LOW);
   break;
}   
switch(reply5){
   case 0:
   digitalWrite(5,HIGH);
   break;
   case 1:
   digitalWrite(5,LOW);
   break;
}
switch(reply6){
   case 0:
     digitalWrite(6,HIGH);
     break;
   case 1:
     digitalWrite(6,LOW);
     break;
}
   switch(reply7){
   case 0:
   digitalWrite(7,HIGH);
   break;
   case 1:
   digitalWrite(7,LOW);
   break;
}   
   switch(reply8){
   case 0:
   digitalWrite(8,HIGH);
   break;
   case 1:
   digitalWrite(8,LOW); 
   break;
}
delay(500);
}
  
 

Credits

JohnHack

JohnHack

0 projects • 0 followers

Comments