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.
Diff: displayDriver.cpp
- Revision:
- 18:ef0569bea7e9
- Parent:
- 17:082d51603f20
--- a/displayDriver.cpp Tue Dec 01 09:55:54 2020 +0000
+++ b/displayDriver.cpp Tue Dec 01 12:27:22 2020 +0000
@@ -1,11 +1,16 @@
-DigitalOut a(p19);
-DigitalOut b(p10);
-DigitalOut c(p9);
-DigitalOut d(p7);
-DigitalOut e(p8);
-DigitalOut f(p20);
-DigitalOut g(p17);
-DigitalOut dp(p18);
+# include "mbed.h"
+
+DigitalOut a(p24);
+DigitalOut b(p17);
+DigitalOut c(p16);
+DigitalOut d(p14);
+DigitalOut e(p15);
+DigitalOut f(p25);
+DigitalOut g(p22);
+DigitalOut dp(p23);
+
+DigitalOut cat1(p21);
+DigitalOut cat2(p20);
DigitalOut cat[] = {cat1, cat2};
DigitalOut display[] = {a, b, c, d, e, f, g};
@@ -34,20 +39,18 @@
int disp_digits[] = {numi/10, numi%10};
- while (true) {
- for (int d=0; d<2; d++) {
- cat[d] = 1;
- cat[(d+1)%2] = 0;
- for (int seg=0; seg<7; seg++) {
- if (digits[disp_digits[d]][seg] == 1) {
- display[seg] = digits[disp_digits[d]][seg];
- display[seg] = 0;
- }
- }
- if (d == dpi) {
- dp = 1;
- dp = 0;
- }
+ for (int d=0; d<2; d++) {
+ cat[d] = 1;
+ cat[(d+1)%2] = 0;
+ for (int seg=0; seg<7; seg++) {
+ display[seg] = digits[disp_digits[d]][seg];
}
- }
+ for (int seg=0; seg<7; seg++) {
+ display[seg] = 0;
+ }
+ if (d == dpi) {
+ dp = 1;
+ dp = 0;
+ }
+ }
}
\ No newline at end of file
