User:Stonestone/TIB
LED testing #1
Documentation
Error in widget YouTube: unable to write file /data/www/wdka.nl/pzwiki.wdka.nl/mw-mediadesign/extensions/Widgets/compiled_templates/wrt674000219bdb37_97755441
Codes
Code1
int r1 = 13 ;
int r2 = 12 ;
int r3 = 11 ;
int r4 = 10 ;
int r5 = 9 ;
int r6 = 8 ;
int r7 = 4 ;
int r8 = 3 ;
int r9 = 2 ;
int d = random(300);
void setup() {
pinMode(r1, OUTPUT);
pinMode(r2, OUTPUT);
pinMode(r3, OUTPUT);
pinMode(r4, OUTPUT);
pinMode(r5, OUTPUT);
pinMode(r6, OUTPUT);
pinMode(r7, OUTPUT);
pinMode(r8, OUTPUT);
pinMode(r9, OUTPUT);
}
void loop(){
digitalWrite(r1,HIGH);
delay(d);
digitalWrite(r1,LOW);
digitalWrite(r2,HIGH);
delay(d);
digitalWrite(r2,LOW);
digitalWrite(r3,HIGH);
delay(d);
digitalWrite(r3,LOW);
digitalWrite(r4,HIGH);
delay(d);
digitalWrite(r4,LOW);
digitalWrite(r5,HIGH);
delay(d);
digitalWrite(r5,LOW);
digitalWrite(r6,HIGH);
delay(d);
digitalWrite(r6,LOW);
digitalWrite(r7,HIGH);
delay(d);
digitalWrite(r7,LOW);
digitalWrite(r8,HIGH);
delay(d);
digitalWrite(r8,LOW);
digitalWrite(r9,HIGH);
delay(d);
digitalWrite(r9,LOW);
}
Code2
int r1 = 11 ;
int r2 = 9 ;
int r3 = 8 ;
int r4 = 7 ;
int r5 = 6 ;
int r6 = 5 ;
int r7 = 4 ;
int r8 = 3 ;
int r9 = 2 ;
int e = random(30);
// random + 300 for slower speed
int d = (e+30);
// random led
int randomLed = 1 + (random(10));
void setup() {
pinMode(r1, OUTPUT);
pinMode(r2, OUTPUT);
pinMode(r3, OUTPUT);
pinMode(r4, OUTPUT);
pinMode(r5, OUTPUT);
pinMode(r6, OUTPUT);
pinMode(r7, OUTPUT);
pinMode(r8, OUTPUT);
pinMode(r9, OUTPUT);
}
void loop(){
int randomLed1 = 1 + (random(10));
int randomLed2 = 1 + (random(10));
int d = random(30);
int e = random(30);
digitalWrite(randomLed1,HIGH);
delay(d);
digitalWrite(randomLed2,LOW);
delay(e);
}
Code3
int r1 = 11 ;
int r2 = 9 ;
int r3 = 8 ;
int r4 = 7 ;
int r5 = 6 ;
int r6 = 5 ;
int r7 = 4 ;
int r8 = 3 ;
int r9 = 2 ;
int e = random(10);
// random + 300 for slower speed
int d = (e+10);
// random led
int randomLed = 1 + (random(9));
void setup() {
pinMode(r1, OUTPUT);
pinMode(r2, OUTPUT);
pinMode(r3, OUTPUT);
pinMode(r4, OUTPUT);
pinMode(r5, OUTPUT);
pinMode(r6, OUTPUT);
pinMode(r7, OUTPUT);
pinMode(r8, OUTPUT);
pinMode(r9, OUTPUT);
}
void loop(){
int e = random(200);
// random + 300 for slower speed
int d = (e+100);
int randomLed1 = 1 + (random(9));
digitalWrite(randomLed1,HIGH);
delay(d);
digitalWrite(randomLed1,LOW);
delay(d);
}
Notes
20012016
1. 3/4 lights cannot work well. I guess it is because of the connection problem.
2. Stupid codes
22012016
1. Stupid codes is turning less stupid, but still quite stupid.
2. First red led doesn't work, weird.