I need to write a program to do the following with Arduino:
a. turn on the red light for 1 second
b. turn off the red light
c. turn on the blue light for 2 seconds
d. turn off the blue light
e. repeat
I need to write a program to do the following with Arduino:
a. turn on the red light for 1 second
b. turn off the red light
c. turn on the blue light for 2 seconds
d. turn off the blue light
e. repeat
}
void loop(){
digitalWrite(11,LOW);
delay(1000);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
delay(2000);
digitalWrite(12,HIGH);
delay(500);
}
Mark Cisewski wrote:
}
void loop(){
digitalWrite(11,LOW);
delay(1000);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
delay(2000);
digitalWrite(12,HIGH);
delay(500);
}
Does that work?
and as you pointed out Jan Cumps, there is an obvious issue with the code aside from the delays() of death
Maybe that was his intent. To give code with a slight bug, so the OP would have to debug it and learn a little.
Mike
well, other than the delay of death.
Mike
Does it seem a bit strange that a blog/question gets created with a logic given and one of the users with no other postings till now gives code in 3 hours with no comment whatsoever. And then original post gives no dialog/remarks and marks correct. Must be telepathic or ???
Clem
It could be strange, but it could also be that:
1) It was a simple request that a new user could answer
2) New posters may keep it "strictly business" at first, due to shyness, apprehension, etc...
3) No one else jumped on the answer, giving a new user an opportunity to answer a simple question
Maybe I'm too trusting, or you're too suspicious, or somewhere in between
Mike