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: mbed Blinker TextLCD
Revision 6:d8bc26e7d471, committed 2017-02-11
- Comitter:
- jurgis
- Date:
- Sat Feb 11 17:22:03 2017 +0000
- Parent:
- 5:7f4d61016e8c
- Commit message:
- Testing lcd
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 Sat Feb 11 17:22:03 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- a/main.cpp Sat Jan 07 16:02:04 2017 +0000
+++ b/main.cpp Sat Feb 11 17:22:03 2017 +0000
@@ -1,9 +1,11 @@
// Testing MBED with Daniel
#include "mbed.h"
#include "Blinker.h"
+#include "TextLCD.h"
Timer timer;
DigitalOut led1(LED1);
+AnalogIn volatage(A0);
//DigitalOut greenLed(D8);
//DigitalOut redLed(D10);
//DigitalIn button(D9);
@@ -11,6 +13,8 @@
Serial pc(USBTX, USBRX);
jj::Blinker blinker1(led1, timer);
+TextLCD lcd(D2, D3, D4, D5, D6, D7, TextLCD::LCD20x4); // rs, e, d4-d7
+float prevVoltage = 0;
int main()
{
@@ -20,8 +24,18 @@
blinker1.blink(200, 1000);
+ lcd.cls();
+
for(;;)
{
blinker1.update();
+
+ float v = volatage.read() * 3.3f;
+ if (abs(v - prevVoltage) > 0.1f)
+ {
+ lcd.locate(14, 0);
+ lcd.printf("%0.2f V", v);
+ }
+ prevVoltage = v;
}
}