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.
Dependencies: TextLCD USBDevice mbed
Fork of USBSerial_HelloWorld by
Revision 10:e48e63e91873, committed 2013-08-08
- 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 |
--- /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
--- 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
