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.
displayDriver.cpp
- Committer:
- manavkoolz
- Date:
- 2020-12-01
- Revision:
- 17:082d51603f20
- Child:
- 18:ef0569bea7e9
File content as of revision 17:082d51603f20:
DigitalOut a(p19); DigitalOut b(p10); DigitalOut c(p9); DigitalOut d(p7); DigitalOut e(p8); DigitalOut f(p20); DigitalOut g(p17); DigitalOut dp(p18); DigitalOut cat[] = {cat1, cat2}; DigitalOut display[] = {a, b, c, d, e, f, g}; const int digits[10][7] = { {1, 1, 1, 1, 1, 1, 0}, {0, 1, 1, 0, 0, 0, 0}, {1, 1, 0, 1, 1, 0, 1}, {1, 1, 1, 1, 0, 0, 1}, {0, 1, 1, 0, 0, 1, 1}, {1, 0, 1, 1, 0, 1, 1}, {1, 0, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 0, 0, 0}, {1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 0, 1, 1} }; void display_num(float num) { int dpi = 1; int numi = (int)(num); if (((int)num)/10 == 0) { dpi = 0; numi = (int)(num*10); } 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; } } } }