Arduino Hello, I bought two weeks duemilanove arduino, but I want to make a sequel with digital ports and two push buttons, one to turn on and the other off.
example:
Can anyone help put two buttons, one to turn on, and at the end to hang
Some can help me buttons do not work.
int switchon = 12;
int switchoff = 4;
int ledPin = 13;
int disc1 = 11;
int disc2 = 9;
int disc3 = 7;
int puxe = 5;
void setup()
{
pinMode(switchon, INPUT);
pinMode(switchoff, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(disc1, OUTPUT);
pinMode(disc2, OUTPUT);
pinMode(disc3, OUTPUT);
pinMode(puxe, OUTPUT);
}
void loop ()
{
int leitura = digitalRead(switchon);
if (leitura == 0){
digitalWrite(switchon, 1);
}else{
digitalWrite(switchon, 0);
}
digitalWrite(ledPin, HIGH);
delay(3000);
digitalWrite(disc1, HIGH);
delay(3000);
digitalWrite(disc2, HIGH);
delay(3000);
digitalWrite(disc3, HIGH);
delay(3000);
digitalWrite(puxe, HIGH);
delay(3000);
}