int sw=10;
int led=2;
int value=0;
void setup() {
// put your setup code here, to run once:
pinMode(sw,INPUT_PULLUP);
pinMode(led,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
value=digitalRead(sw);
if(value==1)
{
digitalWrite(led,LOW);delay(200);
}
else
{
digitalWrite(led,HIGH);
}
}
沒有留言:
張貼留言