int LED = 13;
int BUTTON = 3;
int val;
void setup()
{
// put your setup code here, to run once:
pinMode(LED,OUTPUT);
pinMode(BUTTON,INPUT);
}
void loop()
{
// put your main code here, to run repeatedly:
val = digitalRead(BUTTON);
if(val == HIGH)
{
digitalWrite(LED,HIGH);
}
else
{
digitalWrite(LED,LOW);
}
}
歡迎光臨 (http://m.zg4o1577.cn/bbs/) | Powered by Discuz! X3.1 |