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@4:59ea87bb5b80, 2020-08-04 (annotated)
- Committer:
- kevinsullivan
- Date:
- Tue Aug 04 10:10:44 2020 +0000
- Revision:
- 4:59ea87bb5b80
- Parent:
- 3:ace46fcebfd6
revised
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kevinsullivan | 0:376219f61e79 | 1 | #include "mbed.h" |
| kevinsullivan | 0:376219f61e79 | 2 | #include "C12832.h" |
| kevinsullivan | 0:376219f61e79 | 3 | Serial pc(USBTX, USBRX); // tx, rx |
| kevinsullivan | 0:376219f61e79 | 4 | PwmOut led1(LED1); |
| kevinsullivan | 0:376219f61e79 | 5 | AnalogIn pot1(p19); |
| kevinsullivan | 0:376219f61e79 | 6 | C12832 lcd(p5,p7,p6,p8,p11); |
| kevinsullivan | 2:6bc37de37167 | 7 | |
| kevinsullivan | 0:376219f61e79 | 8 | int main() |
| kevinsullivan | 0:376219f61e79 | 9 | { |
| kevinsullivan | 4:59ea87bb5b80 | 10 | while(1) { |
| kevinsullivan | 4:59ea87bb5b80 | 11 | float volt_out = pot1; |
| kevinsullivan | 4:59ea87bb5b80 | 12 | led1 = pot1; |
| kevinsullivan | 4:59ea87bb5b80 | 13 | wait(0.01); // stabileise before taking reading |
| kevinsullivan | 4:59ea87bb5b80 | 14 | lcd.locate(0,0); //brings the cursor on the LCD back to the top left corner |
| kevinsullivan | 4:59ea87bb5b80 | 15 | lcd.printf("value = %.3fV\n",volt_out); // displays the voltage value on the LCD1 to 3 decimal places |
| kevinsullivan | 4:59ea87bb5b80 | 16 | lcd.printf("value = %.1eV\n",volt_out); // displays the voltage value on the LCD1 in scientific notation |
| kevinsullivan | 4:59ea87bb5b80 | 17 | |
| kevinsullivan | 0:376219f61e79 | 18 | } |
| kevinsullivan | 0:376219f61e79 | 19 | } |