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.
Diff: main.cpp
- Revision:
- 4:59ea87bb5b80
- Parent:
- 3:ace46fcebfd6
--- a/main.cpp Tue Aug 04 07:43:57 2020 +0000
+++ b/main.cpp Tue Aug 04 10:10:44 2020 +0000
@@ -1,22 +1,19 @@
#include "mbed.h"
#include "C12832.h"
-
Serial pc(USBTX, USBRX); // tx, rx
PwmOut led1(LED1);
-PwmOut led2(LED2);
AnalogIn pot1(p19);
C12832 lcd(p5,p7,p6,p8,p11);
int main()
{
- while(1) {
- float volt_out = pot1;
- led1 = pot1;
- led2 = !led1; // NOT LED1; When led1 is off led2 is on.
- wait(0.01);
- lcd.locate(0,0); //brings the cursor on the LCD back to the top left corner
- lcd.printf("value = %.3fV\n",volt_out); // displays the voltage value on the LCD1 to 3 decimal places
- lcd.printf("value = %.1eV\n",volt_out); // displays the voltage value on the LCD1 in scientific notation
-
+ while(1) {
+ float volt_out = pot1;
+ led1 = pot1;
+ wait(0.01); // stabileise before taking reading
+ lcd.locate(0,0); //brings the cursor on the LCD back to the top left corner
+ lcd.printf("value = %.3fV\n",volt_out); // displays the voltage value on the LCD1 to 3 decimal places
+ lcd.printf("value = %.1eV\n",volt_out); // displays the voltage value on the LCD1 in scientific notation
+
}
}