**KL25Z** AnalogIn, TextLCD, USBDevice demo
Dependencies: TextLCD USBDevice mbed
Fork of USBSerial_HelloWorld by
main.cpp
00001 /*mV_mero_01.cpp 00002 ********KL25Z******** 00003 00004 input: 100K poti GND - P3V3 - A2(PTB2) 00005 00006 */ 00007 #include "mbed.h" 00008 #include "USBSerial.h" 00009 #include "TextLCD.h" 00010 00011 TextLCD lcd(PTB8, PTB9, PTB10, PTB11, PTE2, PTE3); // rs, e, d4-d7 Aruino pin 00012 00013 //Virtual serial port over USB 00014 USBSerial serial; 00015 AnalogIn AnIn(PTB2); //A2 00016 DigitalOut K_led(LED1); //blue led 00017 int main(void) { 00018 float volume=0; // displays init... 00019 K_led=0; 00020 lcd.cls(); 00021 lcd.printf("*mV Measuring *\n"); // LCD 00022 lcd.printf(" --StART-- \n"); 00023 serial.printf("*mV Measuring *\n"); //USB SERIEL (HiperTerminal) 00024 serial.printf(" --StART-- \n"); 00025 wait(2); 00026 lcd.cls(); // TextLCD.h 00027 while(1) 00028 { 00029 volume=int(AnIn.read()*2880); 00030 lcd.locate(0,0); 00031 lcd.printf("Volume:%f",volume); 00032 lcd.locate(13,0); 00033 lcd.printf(" mV "); 00034 serial.printf("Volume:(%f) \r",volume); 00035 wait(0.25); 00036 K_led=!K_led; 00037 } 00038 }
Generated on Fri Aug 5 2022 03:28:16 by 1.7.2