keniti akiba
/
STM32L010F4P6_3MINUTES_TIMER_DISPLAY
STM32L010F4P6 7SEGMENT 0-3
main.cpp@0:b1cad1c48987, 2020-10-18 (annotated)
- Committer:
- caa45040
- Date:
- Sun Oct 18 06:39:32 2020 +0000
- Revision:
- 0:b1cad1c48987
STM32L010 7SEGMENT 0-3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
caa45040 | 0:b1cad1c48987 | 1 | #include "mbed.h" |
caa45040 | 0:b1cad1c48987 | 2 | |
caa45040 | 0:b1cad1c48987 | 3 | |
caa45040 | 0:b1cad1c48987 | 4 | DigitalOut myled1(PA_1); |
caa45040 | 0:b1cad1c48987 | 5 | DigitalOut myled2(PA_2); |
caa45040 | 0:b1cad1c48987 | 6 | DigitalOut myled3(PA_3); |
caa45040 | 0:b1cad1c48987 | 7 | DigitalOut myled4(PA_4); |
caa45040 | 0:b1cad1c48987 | 8 | DigitalOut myled5(PA_5); |
caa45040 | 0:b1cad1c48987 | 9 | DigitalOut myled6(PA_6); |
caa45040 | 0:b1cad1c48987 | 10 | DigitalOut myled7(PA_7); |
caa45040 | 0:b1cad1c48987 | 11 | |
caa45040 | 0:b1cad1c48987 | 12 | DigitalOut myled8(PB_1); |
caa45040 | 0:b1cad1c48987 | 13 | |
caa45040 | 0:b1cad1c48987 | 14 | DigitalIn myin10(PA_10); |
caa45040 | 0:b1cad1c48987 | 15 | DigitalIn myin9(PA_9); |
caa45040 | 0:b1cad1c48987 | 16 | |
caa45040 | 0:b1cad1c48987 | 17 | void seg0(){ |
caa45040 | 0:b1cad1c48987 | 18 | myled1 = 0;myled2 = 0;myled3 = 0;myled4 = 1;myled5 = 0;myled6 = 0;myled7 = 0;myled8 = 1; |
caa45040 | 0:b1cad1c48987 | 19 | } |
caa45040 | 0:b1cad1c48987 | 20 | void seg1(){ |
caa45040 | 0:b1cad1c48987 | 21 | myled1 = 1;myled2 = 0;myled3 = 1;myled4 = 1;myled5 = 1;myled6 = 1;myled7 = 0;myled8 = 1; |
caa45040 | 0:b1cad1c48987 | 22 | } |
caa45040 | 0:b1cad1c48987 | 23 | void seg2(){ |
caa45040 | 0:b1cad1c48987 | 24 | myled1 = 0;myled2 = 0;myled3 = 1;myled4 = 0;myled5 = 0;myled6 = 0;myled7 = 1;myled8 = 1; |
caa45040 | 0:b1cad1c48987 | 25 | } |
caa45040 | 0:b1cad1c48987 | 26 | void seg3(){ |
caa45040 | 0:b1cad1c48987 | 27 | myled1 = 0;myled2 = 0;myled3 = 1;myled4 = 0;myled5 = 1;myled6 = 0;myled7 = 0;myled8 = 1; |
caa45040 | 0:b1cad1c48987 | 28 | } |
caa45040 | 0:b1cad1c48987 | 29 | |
caa45040 | 0:b1cad1c48987 | 30 | |
caa45040 | 0:b1cad1c48987 | 31 | |
caa45040 | 0:b1cad1c48987 | 32 | int main() { |
caa45040 | 0:b1cad1c48987 | 33 | int a = 0; |
caa45040 | 0:b1cad1c48987 | 34 | int b = 1; |
caa45040 | 0:b1cad1c48987 | 35 | |
caa45040 | 0:b1cad1c48987 | 36 | while(1) { |
caa45040 | 0:b1cad1c48987 | 37 | |
caa45040 | 0:b1cad1c48987 | 38 | while( (a = myin9 * 2 + myin10) == b ) {} |
caa45040 | 0:b1cad1c48987 | 39 | |
caa45040 | 0:b1cad1c48987 | 40 | |
caa45040 | 0:b1cad1c48987 | 41 | if ( a == 0 ) { |
caa45040 | 0:b1cad1c48987 | 42 | seg0(); |
caa45040 | 0:b1cad1c48987 | 43 | |
caa45040 | 0:b1cad1c48987 | 44 | } else if ( a == 1 ) { |
caa45040 | 0:b1cad1c48987 | 45 | seg1(); |
caa45040 | 0:b1cad1c48987 | 46 | |
caa45040 | 0:b1cad1c48987 | 47 | } else if ( a == 2 ) { |
caa45040 | 0:b1cad1c48987 | 48 | seg2(); |
caa45040 | 0:b1cad1c48987 | 49 | |
caa45040 | 0:b1cad1c48987 | 50 | } else if ( a == 3 ) { |
caa45040 | 0:b1cad1c48987 | 51 | seg3(); |
caa45040 | 0:b1cad1c48987 | 52 | } |
caa45040 | 0:b1cad1c48987 | 53 | |
caa45040 | 0:b1cad1c48987 | 54 | b=a; |
caa45040 | 0:b1cad1c48987 | 55 | } |
caa45040 | 0:b1cad1c48987 | 56 | } |
caa45040 | 0:b1cad1c48987 | 57 | //SOLD_AT_MERCARI |
caa45040 | 0:b1cad1c48987 | 58 | //ICHIGOJAM |
caa45040 | 0:b1cad1c48987 | 59 | // |
caa45040 | 0:b1cad1c48987 | 60 | //10 '3 MIN TIMER |
caa45040 | 0:b1cad1c48987 | 61 | //20 OUT 10,0:OUT 11,0:'0 |
caa45040 | 0:b1cad1c48987 | 62 | //30 WAIT 60*60-0:' 1M |
caa45040 | 0:b1cad1c48987 | 63 | //40 OUT 10,1:OUT 11,0:'1 |
caa45040 | 0:b1cad1c48987 | 64 | //50 WAIT 60*60-0:' 1M |
caa45040 | 0:b1cad1c48987 | 65 | //60 OUT 10,0:OUT 11,1:'2 |
caa45040 | 0:b1cad1c48987 | 66 | //70 WAIT 60*60-0:' 1M |
caa45040 | 0:b1cad1c48987 | 67 | //80 OUT 10,1:OUT 11,1:'3 |
caa45040 | 0:b1cad1c48987 | 68 | //90 BEEP |