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:
- 0:7c4d476452d1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jan 06 08:27:40 2017 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "C12832.h"
+
+ 
+AnalogIn analog_value(A0);
+AnalogIn POT1(PA_0);
+AnalogIn POT2(PA_1);
+DigitalOut led(LED1);
+C12832 lcd(PA_7,PA_5,PA_6,PA_8,PB_6);
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+
+int main() {
+    int meas;
+    float val;
+    pc.printf("\nAnalogIn example\n");
+    
+    while(1) {
+        meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
+        //meas = meas * 3.3; // Change the value to be in the 0 to 3300 range
+        val = POT2.read();
+        meas = POT1.read_u16();
+       pc.printf("\n measure = %4X \n", meas);
+        pc.printf("valeur = %.2f V", val);
+        lcd.cls();
+        lcd.locate(0,0);
+        lcd.printf("valeur du pot : %.2f", val);
+        lcd.locate(0,15);
+        lcd.printf("valeur du pot : %4X", meas);
+        
+        if (meas > 2000) { // If the value is greater than 2V then switch the LED on
+          led = 1;
+        }
+        else {
+          led = 0;
+        }
+        wait_ms(1000); // 200 ms
+    }
+}