Commit 4cafaf0f authored by Zhuoyu Zhang's avatar Zhuoyu Zhang
Browse files

feat 3.23

parent c7582327
......@@ -3,7 +3,7 @@
#include <Encoder.h>
// 数码管value:0~9
byte smg[10] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f};
byte smg[10] = {0xc0, 0xf9, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f};
// 数码管位选引脚
int com[4] = {6, 5, 4, 3};
......@@ -113,37 +113,39 @@ void setup()
pinMode(CLK, INPUT);
pinMode(DT, INPUT);
pinMode(BEEP, OUTPUT);
selectedTimeIndex = EEPROM.read(0);
TimerMinute = times[selectedTimeIndex] / 100;
TimerSecond = times[selectedTimeIndex] % 100;
// selectedTimeIndex = EEPROM.read(0);
// TimerMinute = times[selectedTimeIndex] / 100;
// TimerSecond = times[selectedTimeIndex] % 100;
displaySMG(0,1);
}
void loop()
{
// put your main code here, to run repeatedly:
// 读取旋转编码器的值
encoderVal = encoder.read();
// 旋转编码器按键按下
if (!digitalRead(SW))
{
isStop = !isStop;
digitalWrite(BEEP, LOW);
// 等待按键抬起
while (!digitalRead(SW))
;
EEPROM.write(0, selectedTimeIndex);
}
// 计时暂停状态
if (isStop)
{
changeSetTime(encoderVal);
}
else
{
updateTime();
}
displaySMG(0, TimerMinute / 10);
displaySMG(1, TimerMinute % 10);
displaySMG(2, TimerSecond / 10);
displaySMG(3, TimerSecond % 10);
}
\ No newline at end of file
// // put your main code here, to run repeatedly:
// // 读取旋转编码器的值
// encoderVal = encoder.read();
// // 旋转编码器按键按下
// if (!digitalRead(SW))
// {
// isStop = !isStop;
// digitalWrite(BEEP, LOW);
// // 等待按键抬起
// while (!digitalRead(SW))
// ;
// EEPROM.write(0, selectedTimeIndex);
// }
// // 计时暂停状态
// if (isStop)
// {
// changeSetTime(encoderVal);
// }
// else
// {
// updateTime();
// }
// displaySMG(0, TimerMinute / 10);
// displaySMG(1, TimerMinute % 10);
// displaySMG(2, TimerSecond / 10);
// displaySMG(3, TimerSecond % 10);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment