JAEHAN PARK / Mbed 2 deprecated 20190929assignment2-1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
PARKJAEHAN
Date:
Sun Sep 29 11:53:43 2019 +0000
Commit message:
20190929assignment1;

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 Sep 29 11:53:43 2019 +0000
@@ -0,0 +1,54 @@
+#include "mbed.h"
+
+DigitalOut greenLed(LED1);
+BusOut my7Seg(PA_8, PA_9, PA_10, PC_9, PC_8, PC_7, PC_6, PA_11); //8bit data
+              //LSB                                       MSB
+
+int main(){
+    my7Seg = 0xFF;
+    greenLed = 1;
+    
+    char temp7Seg;
+    
+    while (1) {
+        for (int n=0; n<10; n++) {
+            switch(n) {
+                case 0:
+                    temp7Seg = ~0x3F;
+                    break;
+                case 1:
+                    temp7Seg = ~0x06;
+                    break;
+                case 2:
+                    temp7Seg = ~0x5B;
+                    break;
+                case 3:
+                    temp7Seg = ~0x4F;
+                    break;
+                case 4:
+                    temp7Seg = ~0x66;
+                    break;
+                case 5:
+                    temp7Seg = ~0x6D;
+                    break;
+                case 6:
+                    temp7Seg = ~0x7D;
+                    break;
+                case 7:
+                    temp7Seg = ~0x07;
+                    break;
+                case 8:
+                    temp7Seg = ~0x7F;
+                    break;
+                case 9:
+                    temp7Seg = ~0x6F;
+                    break;
+                    }
+                    
+                    greenLed = !greenLed;
+                    my7Seg = (temp7Seg & 0x7F) | ((greenLed & 0x01) << 7 );
+                    
+                    wait (0.5);    
+                }
+            }
+}   
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Sep 29 11:53:43 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file