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://www.51hei.com/bbs/) | Powered by Discuz! X3.1 |