Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:0bf29dbfe4d5, committed 2021-02-03
- 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 |
--- /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
--- /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