This program displays a series of text messages on a 16x2 line LCD and also then displays the room temperature taken from a TMP102 I2C module. It represents my first attempt to do anything useful with an mbed which is something I got my hands on less than 4 days ago. It shows what can be achieved by someone who has no prior knowledge of C after about 4 hours of tinkering with various sample programs. This code itself took me around 40 minutes of that 4 hours of play time to craft. The LCD is hooked up to the mbed as per the TextLCD program instructions. The TMP102 module is hooked up as per the TMP102HelloWorld program instructions. If you want to hook up some of the more complex components in your Cool Components starter kit and see them work in a matter of minutes, this little showcase program will do just that. Enjoy. Thanks to whoever wrote the libraries and original code which I used.

Dependencies:   TextLCD mbed TMP102

Files at this revision

API Documentation at this revision

Comitter:
bigweggy
Date:
Sat Apr 21 10:54:24 2012 +0000
Commit message:
This program is a quick mash up which I made up from 2 other programs found on the cookbook. It is a combination of the TextLCD code and the TMP102HelloWorld program.

Changed in this revision

TMP102.lib Show annotated file Show diff for this revision Revisions of this file
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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TMP102.lib	Sat Apr 21 10:54:24 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/TMP102/#b469676e9a9e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Sat Apr 21 10:54:24 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Apr 21 10:54:24 2012 +0000
@@ -0,0 +1,64 @@
+// Hello World! for the TextLCD
+
+#include "mbed.h"
+#include "TextLCD.h"
+#include "TMP102.h"
+
+TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
+TMP102 temperature(p9, p10, 0x90); //A0 pin is connected to ground
+int main() {
+    while (1) {
+        lcd.printf("Hello.I'm MBED. ");
+        lcd.printf("Microcontroller ");
+        wait(3);
+
+        lcd.printf("Rapid Protoyping");
+        lcd.printf("System created  ");
+        wait(3);
+
+        lcd.printf("by ARM-Cambridge");
+        lcd.printf("That's  ENGLAND!");
+        wait(3);
+
+        lcd.printf("You can write   ");
+        lcd.printf("a program for me");
+        wait(3);
+
+        lcd.printf("quickly & easily");
+        lcd.printf("using the online");
+        wait(3);
+
+        lcd.printf("C compiler in   ");
+        lcd.printf("the cloud. There");
+        wait(3);
+
+        lcd.printf("is also a vast  ");
+        lcd.printf("cookbook online ");
+        wait(3);
+
+        lcd.printf("where you can   ");
+        lcd.printf("find lots of    ");
+        wait(3);
+
+        lcd.printf("example code to ");
+        lcd.printf("experiment with ");
+        wait(3);
+
+        lcd.printf("to create       ");
+        lcd.printf("programs like   ");
+        wait(3);
+
+        lcd.printf("this one in     ");
+        lcd.printf("minutes!        ");
+        wait(3);
+
+        lcd.printf("                ");
+        lcd.printf("                ");
+        wait(3);
+
+        lcd.printf("Temp is:        ");
+        lcd.printf("%.1f degrees C\n", temperature.read()) ;
+        wait(3);
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Apr 21 10:54:24 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e