-
Notifications
You must be signed in to change notification settings - Fork 0
/
STM32 code
84 lines (73 loc) · 1.15 KB
/
STM32 code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "mbed.h"
#include "TextLCD.h"
TextLCD lcd(PA_3,PA_2,PA_10,PB_3,PB_5,PB_4);
int h = 00;
int m = 4;
int s = 55;
int flag = 0;
int TIME = 0;
DigitalOut L1(PB_1);
DigitalOut L2(PB_6);
DigitalIn buzz(PB_9);
DigitalIn pb(PC_5);
int main(){
while(1){
int v=pb;
s = s + 1;
lcd.printf("TIME:");
lcd.printf(h);
lcd.printf(":");
lcd.printf(m);
lcd.printf(":");
lcd.printf(s);
if (flag == 24)
flag = 0;
wait(1);
lcd.clear();
if (s == 60)
{
s = 0;
m = m + 1;
}
if (m == 60)
{
m = 0;
h = h + 1;
flag = flag + 1;
}
if (h == 24)
{
h = 0;
}
if (h == 0 && m == 5)
{
// 1st led
if (s <= 10 )
{
L1=1;
buzz=1;
lcd.printf("Crocin");
}
}
if (v == 0)
{
L1=0;
buzz=0;
}
if (h == 0 && m == 6)
{
// 2nd led
if (s<=10)
{
L2=1;
buzz=1;
lcd.printf("Flexon");
}
}
if (v == 0)
{
L2=0;
buzz=0;
}
}
}