Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zhuoyu Zhang
MDSY
Commits
4cafaf0f
Commit
4cafaf0f
authored
Mar 23, 2023
by
Zhuoyu Zhang
Browse files
feat 3.23
parent
c7582327
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main.cpp
View file @
4cafaf0f
...
...
@@ -3,7 +3,7 @@
#include
<Encoder.h>
// 数码管value:0~9
byte
smg
[
10
]
=
{
0x
3f
,
0x
06
,
0x5b
,
0x4f
,
0x66
,
0x6d
,
0x7d
,
0x07
,
0x7f
,
0x6f
};
byte
smg
[
10
]
=
{
0x
c0
,
0x
f9
,
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);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment