#include <Bounce2.h>
Bounce btn =Bounce(2,50);//宣告按键
Bounce btn =Bounce(2,50);//宣告按键
int LCDbacklight=LOW; //存储LCD背光状态
long previousMillis = 0;
long interval = 15000;
void setup() {
pinMode(2,INPUT);
}
void loop()
{
unsigned long currentMillis = millis(); //系统运行时间
unsigned long currentMillis = millis(); //系统运行时间
if(LCDbacklight==HIGH);
{
if(currentMillis - previousMillis > interval)
{
{
if(currentMillis - previousMillis > interval)
{
lcd.noBacklight(); //LCD背光关闭
LCDbacklight=LOW;
}
}
LCDbacklight=LOW;
}
}
if(btn.update()==true && btn.read()==HIGH)
{
previousMillis = currentMillis;
LCDbacklight=HIGH; //存储LCD背光状态
lcd.backlight();//打开LCD背光
}
没有评论:
发表评论