JOe Chacon / Mbed 2 deprecated JChac-342-4_2

Dependencies:   SLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
ceojoe
Date:
Sun Sep 20 21:50:37 2015 +0000
Commit message:
Problem 1 - Output random value to onboard LCD

Changed in this revision

SLCD.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 5d6f30101feb SLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SLCD.lib	Sun Sep 20 21:50:37 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/SLCD/#ef2b3b7f1b01
diff -r 000000000000 -r 5d6f30101feb main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Sep 20 21:50:37 2015 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+#include "SLCD.h"
+
+#define DATATIME 250 // 250 milliseconds
+#define LASTDGDIV 10
+#define PROGNAME "JChac_341_4_2_Analog Rand v1\n\r"
+
+AnalogIn analogRand(PTB0);
+DigitalOut Rled(LED_RED);
+Serial pc(USBTX, USBRX);
+
+SLCD slcd; // New instance of LCD
+
+ 
+void LCDMess(unsigned int lMess){
+        slcd.Home();
+        slcd.clear();
+        slcd.printf("%d", lMess);
+}
+
+int main()
+{
+    float analogValue;
+    unsigned int analogBits;
+    unsigned int lastDigit;
+    pc.printf(PROGNAME);
+    while (true) {
+     analogValue = analogRand.read();
+     analogBits = analogRand.read_u16();
+     lastDigit = analogBits % LASTDGDIV;
+     Rled = !Rled; // toggle red
+     LCDMess(lastDigit);
+     pc.printf("%0.5f, %d, %1d\n\r", analogValue, analogBits, lastDigit); 
+     wait_ms(DATATIME);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 5d6f30101feb mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Sep 20 21:50:37 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4f6c30876dfa
\ No newline at end of file