**KL25Z** AnalogIn, TextLCD, USBDevice demo

Dependencies:   TextLCD USBDevice mbed

Fork of USBSerial_HelloWorld by Samuel Mokrani

Files at this revision

API Documentation at this revision

Comitter:
szjenter
Date:
Thu Aug 08 15:11:53 2013 +0000
Parent:
9:d88699a0905a
Commit message:
mV Measuring; input:0-3.3V -> PTB4; output: LCD; USB Serial

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r d88699a0905a -r e48e63e91873 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Thu Aug 08 15:11:53 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#a53b3e2d6f1e
diff -r d88699a0905a -r e48e63e91873 main.cpp
--- a/main.cpp	Fri Mar 01 13:33:02 2013 +0000
+++ b/main.cpp	Thu Aug 08 15:11:53 2013 +0000
@@ -1,14 +1,38 @@
+/*mV_mero_01.cpp
+********KL25Z********
+
+input: 100K poti GND - P3V3 - A2(PTB2)
+
+*/
 #include "mbed.h"
 #include "USBSerial.h"
- 
+#include "TextLCD.h" 
+
+TextLCD lcd(PTB8, PTB9, PTB10, PTB11, PTE2, PTE3); // rs, e, d4-d7 Aruino pin
+
 //Virtual serial port over USB
 USBSerial serial;
- 
+AnalogIn AnIn(PTB2);        //A2
+DigitalOut K_led(LED1);     //blue led
 int main(void) {
- 
+    float volume=0;                         // displays init...
+    K_led=0;                                        
+    lcd.cls();
+    lcd.printf("*mV Measuring *\n");        // LCD
+    lcd.printf("   --StART--   \n");
+    serial.printf("*mV Measuring *\n");     //USB SERIEL (HiperTerminal)
+    serial.printf("   --StART--   \n");
+    wait(2);
+    lcd.cls();                  // TextLCD.h 
     while(1)
     {
-        serial.printf("I am a virtual serial port\r\n");
-        wait(1);
+        volume=int(AnIn.read()*2880);
+        lcd.locate(0,0);
+        lcd.printf("Volume:%f",volume);
+        lcd.locate(13,0);
+        lcd.printf(" mV   ");
+        serial.printf("Volume:(%f) \r",volume);
+        wait(0.25);
+        K_led=!K_led;
     }
 }
\ No newline at end of file