hi really new to arduino programming, basically what i want to do is press my push button in pin 1 and have it turn on my led in pin 3 for 3 seconds and my led in pin 5 for 6 seconds. any help here is greatly appreciated. thanks
What problem are you having doing that?
how do i write it, as i say very new to arduino only have mine a few days. thanks
collyd21:
how do i write it, as i say very new to arduino only have mine a few days. thanks
Have you gone through the examples to start learning how to use the Arduino, or do you want somebody to write the code for you?
Have you looked at any of the examples, like the blink without delay example?
void setup(){
pinMode(1,INPUT);
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
}
void loop(){
if(digitalRead(1)==1){
digitalWrite(3,HIGH);
digitalWrite(5,HIGH);
delay(3000);
digitalWrite(3,LOW);
delay(3000);
digitalWrite(5,LOW);
}
else{
}}
try this. I have not tested it yet, but it compiles.
jared
else
{
}
Why? If there is nothing to do, the else block is not needed.