User:Stonestone/TIB: Difference between revisions
Stonestone (talk | contribs) (Created page with " <div style="width:80%; font-family:Courier; padding:2px; float:center;font-size:15;background:#FFFFE0; border:1px solid black"> == LED testing #1 == === Documentation === [...") |
Stonestone (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
=== Documentation === | === Documentation === | ||
{{youtube|fANXUHP56Os|center|thumb|400px|LED1}} <br /> | {{youtube|fANXUHP56Os|center|thumb|400px|LED1}} <br /> | ||
=== Codes === | === Codes === | ||
Code1<br /> | |||
<source lang="c"> | <source lang="c"> | ||
int r1 = 13 ; | int r1 = 13 ; | ||
Line 61: | Line 62: | ||
</source> | </source> | ||
<br /> | <br /> | ||
=== | Code2<br /> | ||
<source lang="c"> | |||
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); | |||
} | |||
</source><br /> | |||
Code3<br /> | |||
<source lang="c"> | |||
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); | |||
} | |||
</source> | |||
=== Notes === | |||
20012016<br /> | |||
1. 3/4 lights cannot work well. I guess it is because of the connection problem. <br /> | |||
2. Stupid codes <br /> | |||
22012016<br /> | |||
1. Stupid codes is turning less stupid, but still quite stupid.<br /> | |||
2. First red led doesn't work, weird. | |||
</div> | </div> |
Latest revision as of 18:22, 22 January 2016
LED testing #1
Documentation
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.