STM32L010F4P6 7SEGMENT 0-3

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
caa45040
Date:
Sun Oct 18 06:39:32 2020 +0000
Commit message:
STM32L010 7SEGMENT 0-3

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Oct 18 06:39:32 2020 +0000
@@ -0,0 +1,68 @@
+#include "mbed.h"
+
+
+DigitalOut myled1(PA_1);
+DigitalOut myled2(PA_2);
+DigitalOut myled3(PA_3);
+DigitalOut myled4(PA_4);
+DigitalOut myled5(PA_5);
+DigitalOut myled6(PA_6);
+DigitalOut myled7(PA_7);
+
+DigitalOut myled8(PB_1);
+
+DigitalIn myin10(PA_10);
+DigitalIn myin9(PA_9);
+
+void seg0(){
+myled1 = 0;myled2 = 0;myled3 = 0;myled4 = 1;myled5 = 0;myled6 = 0;myled7 = 0;myled8 = 1;
+}
+void seg1(){
+myled1 = 1;myled2 = 0;myled3 = 1;myled4 = 1;myled5 = 1;myled6 = 1;myled7 = 0;myled8 = 1;
+}
+void seg2(){
+myled1 = 0;myled2 = 0;myled3 = 1;myled4 = 0;myled5 = 0;myled6 = 0;myled7 = 1;myled8 = 1;
+}
+void seg3(){
+myled1 = 0;myled2 = 0;myled3 = 1;myled4 = 0;myled5 = 1;myled6 = 0;myled7 = 0;myled8 = 1;
+}
+
+
+
+int main() {
+    int a = 0;
+    int b = 1;
+    
+    while(1) {
+        
+        while( (a = myin9 * 2 + myin10) == b ) {}
+        
+        
+        if ( a == 0 ) {      
+        seg0();
+        
+        } else if ( a == 1 ) {
+        seg1();
+ 
+        } else if ( a == 2 ) {
+        seg2();
+ 
+        } else if ( a == 3 ) {
+        seg3();
+        }
+         
+        b=a;
+    }
+}
+//SOLD_AT_MERCARI
+//ICHIGOJAM
+//
+//10 '3 MIN TIMER
+//20 OUT 10,0:OUT 11,0:'0
+//30 WAIT 60*60-0:' 1M
+//40 OUT 10,1:OUT 11,0:'1
+//50 WAIT 60*60-0:' 1M
+//60 OUT 10,0:OUT 11,1:'2
+//70 WAIT 60*60-0:' 1M
+//80 OUT 10,1:OUT 11,1:'3
+//90 BEEP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Oct 18 06:39:32 2020 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/86740a56073b
\ No newline at end of file