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 18:ef0569bea7e9, committed 2020-12-01
- Comitter:
- bky
- Date:
- Tue Dec 01 12:27:22 2020 +0000
- Parent:
- 17:082d51603f20
- Commit message:
- Dobby is a free elf
Changed in this revision
displayDriver.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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
--- a/main.cpp Tue Dec 01 09:55:54 2020 +0000 +++ b/main.cpp Tue Dec 01 12:27:22 2020 +0000 @@ -7,7 +7,7 @@ # define NUM_HOLES 32 # define CIRCUMFRENCE_CM 48.6946861 -# define LIGHT_SENSOR_PIN p15 +# define LIGHT_SENSOR_PIN p18 # define FLASH_THRESHOLD 0.02 # define PERIOD_MS 500 # define RUNTIME 120000 // 2 mins @@ -25,7 +25,7 @@ void displayThread_cb() { while(velocity >= 0) { - display(velocity); + display_num(velocity); } return; }