四博智联产品售后
标题:
键控Led灯
[打印本页]
作者:
ycf
时间:
2015-12-25 17:05
标题:
键控Led灯
#define PIN_LED 16
#define KEY_FLASH 0
void setup() {
pinMode(PIN_LED, OUTPUT); // Initialize the BUILTIN_LED pin as an output
pinMode(KEY_FLASH, INPUT);
digitalWrite(PIN_LED,LOW);//点亮LED灯
}
// the loop function runs over and over again forever
void loop() {
/*
digitalWrite(BUILTIN_LED, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is acive low on the ESP-01)
delay(1000); // Wait for a second
digitalWrite(BUILTIN_LED, HIGH); // Turn the LED off by making the voltage HIGH
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
*/
if(digitalRead(KEY_FLASH)==0)
digitalWrite(PIN_LED,HIGH);
else
digitalWrite(PIN_LED,LOW);
}
复制代码
欢迎光临 四博智联产品售后 (http://115.29.109.104/)
Powered by Discuz! X3.2