From c163e93b29c24523bddf542500733aec66213bfc Mon Sep 17 00:00:00 2001 From: IoTcat Date: Tue, 9 Apr 2019 16:04:42 +0800 Subject: [PATCH] fix reset --- digital-clock.ino | 3 ++- switch.h | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/digital-clock.ino b/digital-clock.ino index 3c3787f..f40cec7 100644 --- a/digital-clock.ino +++ b/digital-clock.ino @@ -80,7 +80,8 @@ void loop(){ //如果reset键被按下,重置时钟 if(reset.isPressed() == true) { clock.reset(); - swi.changeStatus(); + swi.changeStatus(15); + reset.changeStatus(1); } //如果开关打开,则开始或停止计时 diff --git a/switch.h b/switch.h index ad73a27..388ac0d 100644 --- a/switch.h +++ b/switch.h @@ -43,7 +43,11 @@ public: return _status; } - bool changeStatus(){ + void changeStatus(int state){ + if(state == 15){ + this->_status = true; + return; + } this->_status = !(this->_status); }