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.
Dependencies: mbed C12832_lcd
main.cpp@0:275c29641333, 2018-11-09 (annotated)
- Committer:
- mazmonem
- Date:
- Fri Nov 09 16:44:37 2018 +0000
- Revision:
- 0:275c29641333
- Child:
- 1:13aae0117bbf
timer
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mazmonem | 0:275c29641333 | 1 | #include "mbed.h" |
| mazmonem | 0:275c29641333 | 2 | #include "C12832_lcd.h" |
| mazmonem | 0:275c29641333 | 3 | |
| mazmonem | 0:275c29641333 | 4 | |
| mazmonem | 0:275c29641333 | 5 | C12832_LCD lcd; |
| mazmonem | 0:275c29641333 | 6 | Timeout increment; |
| mazmonem | 0:275c29641333 | 7 | |
| mazmonem | 0:275c29641333 | 8 | int hours=0; |
| mazmonem | 0:275c29641333 | 9 | int minutes=0; |
| mazmonem | 0:275c29641333 | 10 | |
| mazmonem | 0:275c29641333 | 11 | void adj_min() { |
| mazmonem | 0:275c29641333 | 12 | if (minutes>59) { |
| mazmonem | 0:275c29641333 | 13 | hours++; |
| mazmonem | 0:275c29641333 | 14 | minutes=0; |
| mazmonem | 0:275c29641333 | 15 | } |
| mazmonem | 0:275c29641333 | 16 | } |
| mazmonem | 0:275c29641333 | 17 | void inc_min() { |
| mazmonem | 0:275c29641333 | 18 | minutes++; |
| mazmonem | 0:275c29641333 | 19 | adj_min() ; |
| mazmonem | 0:275c29641333 | 20 | |
| mazmonem | 0:275c29641333 | 21 | if (hours>23) { |
| mazmonem | 0:275c29641333 | 22 | hours = 0; |
| mazmonem | 0:275c29641333 | 23 | } |
| mazmonem | 0:275c29641333 | 24 | } |
| mazmonem | 0:275c29641333 | 25 | int main() { |
| mazmonem | 0:275c29641333 | 26 | while(true) { |
| mazmonem | 0:275c29641333 | 27 | increment.attach(&inc_min, 60.0); |
| mazmonem | 0:275c29641333 | 28 | } |
| mazmonem | 0:275c29641333 | 29 | lcd.cls(); |
| mazmonem | 0:275c29641333 | 30 | lcd.locate(0,15); |
| mazmonem | 0:275c29641333 | 31 | lcd.printf("%d", minutes); |
| mazmonem | 0:275c29641333 | 32 | } |