You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
783 B
43 lines
783 B
int rPin = 11;
|
|
int gPin = 10;
|
|
int bPin = 9;
|
|
|
|
int tstPin = 3;
|
|
|
|
void setup() {
|
|
// put your setup code here, to run once:
|
|
pinMode(rPin, OUTPUT); // R
|
|
pinMode(gPin, OUTPUT); // G
|
|
pinMode(bPin, OUTPUT); // B
|
|
pinMode(5, OUTPUT); // transistor
|
|
pinMode(4, OUTPUT); // transistor
|
|
|
|
pinMode(tstPin, OUTPUT); // test
|
|
}
|
|
|
|
void loop() {
|
|
// put your main code here, to run repeatedly:
|
|
if(rand()%2){
|
|
digitalWrite(tstPin,HIGH);
|
|
}
|
|
else{
|
|
digitalWrite(tstPin,LOW);
|
|
}
|
|
digitalWrite(rPin,0.6*15);
|
|
digitalWrite(gPin,0.3*15*0);
|
|
digitalWrite(bPin,0.1*15*0);
|
|
if(rand()%2){
|
|
digitalWrite(4,HIGH);
|
|
}
|
|
else{
|
|
digitalWrite(4,LOW);
|
|
}
|
|
if(rand()%2){
|
|
digitalWrite(5,HIGH);
|
|
}
|
|
else{
|
|
digitalWrite(5,LOW);
|
|
}
|
|
// digitalWrite(5,LOW);
|
|
delay(1000);
|
|
}
|
|
|