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.
Revision 0:5d6f30101feb, committed 2015-09-20
- 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
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