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.
Fork of Max7221 by
main.cpp@1:d8589d1f368c, 2013-08-06 (annotated)
- Committer:
- jakowisp
- Date:
- Tue Aug 06 08:18:53 2013 +0000
- Revision:
- 1:d8589d1f368c
- Parent:
- 0:cb8e1d05a4a7
- Child:
- 2:828c62cc1861
Library mostly complete. Need to clean up code and document.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jakowisp | 1:d8589d1f368c | 1 | #include "mbed.h" |
| jakowisp | 1:d8589d1f368c | 2 | #include "Max7221.h" |
| jakowisp | 1:d8589d1f368c | 3 | |
| jakowisp | 1:d8589d1f368c | 4 | |
| jakowisp | 1:d8589d1f368c | 5 | // p5: DIN, p7: CLK, p8: LOAD/CS |
| jakowisp | 1:d8589d1f368c | 6 | // Max7221 max7221disp1(p5, p7, p8); |
| jakowisp | 1:d8589d1f368c | 7 | Max7221 max7221disp1(p11, p13, p14); |
| jakowisp | 1:d8589d1f368c | 8 | |
| jakowisp | 1:d8589d1f368c | 9 | int count=-9999999; |
| jakowisp | 1:d8589d1f368c | 10 | |
| jakowisp | 1:d8589d1f368c | 11 | void loop(void) { |
| jakowisp | 1:d8589d1f368c | 12 | max7221disp1.WriteInt(count); |
| jakowisp | 1:d8589d1f368c | 13 | if (count < 10) |
| jakowisp | 1:d8589d1f368c | 14 | count=count+1; |
| jakowisp | 1:d8589d1f368c | 15 | else |
| jakowisp | 1:d8589d1f368c | 16 | count=-9999999; |
| jakowisp | 1:d8589d1f368c | 17 | } |
| jakowisp | 1:d8589d1f368c | 18 | |
| jakowisp | 1:d8589d1f368c | 19 | int main() { |
| jakowisp | 1:d8589d1f368c | 20 | |
| jakowisp | 1:d8589d1f368c | 21 | max7221disp1.Setup(); |
| jakowisp | 1:d8589d1f368c | 22 | Max7221::WriteAll(0x0f,0x01); |
| jakowisp | 1:d8589d1f368c | 23 | wait_ms(500); |
| jakowisp | 1:d8589d1f368c | 24 | Max7221::WriteAll(0x0f,0x00); |
| jakowisp | 1:d8589d1f368c | 25 | max7221disp1.WriteFloat(123.125); |
| jakowisp | 1:d8589d1f368c | 26 | wait(1.0); |
| jakowisp | 1:d8589d1f368c | 27 | |
| jakowisp | 1:d8589d1f368c | 28 | |
| jakowisp | 1:d8589d1f368c | 29 | while (1) { |
| jakowisp | 1:d8589d1f368c | 30 | loop(); |
| jakowisp | 1:d8589d1f368c | 31 | wait(1.0); |
| jakowisp | 1:d8589d1f368c | 32 | } |
| jakowisp | 1:d8589d1f368c | 33 | } |
| jakowisp | 1:d8589d1f368c | 34 |
