int ledPin=3;
int buttonState;
void setup()
{
// put your setup code here, to run once:
pinMode(ledPin,OUTPUT);
pinMode(buttonPin,INPUT);
}
void loop()
{
// put your main code here, to run repeatedly:
buttonState=digitalRead(buttonPin);
if(buttonState==LOW)
{
digitalWrite(ledPin,LOW);
}
else
{
digitalWrite(ledPin,HIGH);
}
}
沒有留言:
張貼留言