const int LED1 = 12;
const int LED2 = 13;
void setup()
{
pinMode(LED1,OUTPUT);
pinMode(LED2,OUTPUT);
}
void loop()
{
digitalWrite(LED1,HIGH);
delay(1000);
digitalWrite(LED1,LOW);
digitalWrite(LED2,HIGH);
delay(1000);
digitalWrite(LED2,LOW);
}
const int LED = 13;
const int SW = 7;
int val=0;
void setup()
{
pinMode(LED,OUTPUT);
pinMode(SW, INPUT);
}
void loop()
{
val=digitalRead(SW);
if(val==HIGH)
{
digitalWrite(LED,HIGH);
}
else
{
digitalWrite(LED,LOW);
}
}