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.
main.cpp@0:a2bd6b5198cb, 2016-06-02 (annotated)
- Committer:
- ameyer
- Date:
- Thu Jun 02 12:22:03 2016 +0000
- Revision:
- 0:a2bd6b5198cb
- Child:
- 1:97730fe3f608
First version. Light library for display on a LCD screen. 4-bit interface with KS0070B lcd driver.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ameyer | 0:a2bd6b5198cb | 1 | #include "mbed.h" |
| ameyer | 0:a2bd6b5198cb | 2 | #include "KS0070B_user.h" |
| ameyer | 0:a2bd6b5198cb | 3 | |
| ameyer | 0:a2bd6b5198cb | 4 | AnalogIn c(p20); |
| ameyer | 0:a2bd6b5198cb | 5 | |
| ameyer | 0:a2bd6b5198cb | 6 | int main() |
| ameyer | 0:a2bd6b5198cb | 7 | { |
| ameyer | 0:a2bd6b5198cb | 8 | float val; |
| ameyer | 0:a2bd6b5198cb | 9 | lcdprint("Contrast: "); |
| ameyer | 0:a2bd6b5198cb | 10 | lcdgoto(1, 14); |
| ameyer | 0:a2bd6b5198cb | 11 | lcdprint("%"); |
| ameyer | 0:a2bd6b5198cb | 12 | while(1) { |
| ameyer | 0:a2bd6b5198cb | 13 | val=1-2.42*c; |
| ameyer | 0:a2bd6b5198cb | 14 | lcdgoto(0, 10); |
| ameyer | 0:a2bd6b5198cb | 15 | lcdprintnb(2*(val-0.5), 1, 3); |
| ameyer | 0:a2bd6b5198cb | 16 | lcdgoto(1, 10); |
| ameyer | 0:a2bd6b5198cb | 17 | lcdprintnb(100*val, 3, 0); |
| ameyer | 0:a2bd6b5198cb | 18 | wait(0.1); |
| ameyer | 0:a2bd6b5198cb | 19 | } |
| ameyer | 0:a2bd6b5198cb | 20 | } |