Andrew Bell / Mbed 2 deprecated repositorylab2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
andrewbw01
Date:
Wed Feb 03 16:04:38 2021 +0000
Commit message:
not working yet

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
diff -r 000000000000 -r 0bf29dbfe4d5 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Feb 03 16:04:38 2021 +0000
@@ -0,0 +1,62 @@
+#include "mbed.h"
+
+BusOut LED_Disp(p7,p11,p9,p8,p5,p6,p10,p12);
+
+DigitalIn plusbutton(p14);
+DigitalIn minusbutton(p15);
+DigitalOut LED(LED1);
+DigitalOut LED_2 (LED2);
+
+void DisplayNumber(int); 
+
+int main()
+{
+    int counter = 0;
+    DisplayNumber(counter);
+    
+    while(1)
+    {
+        if (plusbutton == 1)
+        {
+            LED = 1;
+            wait(1.0);
+            LED = 0;
+            counter++;
+            DisplayNumber(counter);
+            wait(0.5);
+        }
+        
+        if (minusbutton == 1) 
+        {
+            LED_2 = 1;
+            wait(1.0);
+            LED_2 = 0;
+            counter--;
+            DisplayNumber(counter);
+            wait(0.5);
+        }
+    }
+}
+void DisplayNumber(int num) 
+
+{
+    switch(num)    
+    {
+        case 0: 
+        LED_Disp = ~0x3F;             // bit pattern for 0 
+        break; 
+            
+        case 1:
+        LED_Disp = ~0x06;
+        break;
+        
+        case 2:
+        LED_Disp = ~0x5B;
+        break;  
+    }
+}
+    
+    
+            
+            
+             
\ No newline at end of file
diff -r 000000000000 -r 0bf29dbfe4d5 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Feb 03 16:04:38 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file