Robert Wegg / Mbed 2 deprecated Showcase

Dependencies:   TextLCD mbed TMP102

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // Hello World! for the TextLCD
00002 
00003 #include "mbed.h"
00004 #include "TextLCD.h"
00005 #include "TMP102.h"
00006 
00007 TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
00008 TMP102 temperature(p9, p10, 0x90); //A0 pin is connected to ground
00009 int main() {
00010     while (1) {
00011         lcd.printf("Hello.I'm MBED. ");
00012         lcd.printf("Microcontroller ");
00013         wait(3);
00014 
00015         lcd.printf("Rapid Protoyping");
00016         lcd.printf("System created  ");
00017         wait(3);
00018 
00019         lcd.printf("by ARM-Cambridge");
00020         lcd.printf("That's  ENGLAND!");
00021         wait(3);
00022 
00023         lcd.printf("You can write   ");
00024         lcd.printf("a program for me");
00025         wait(3);
00026 
00027         lcd.printf("quickly & easily");
00028         lcd.printf("using the online");
00029         wait(3);
00030 
00031         lcd.printf("C compiler in   ");
00032         lcd.printf("the cloud. There");
00033         wait(3);
00034 
00035         lcd.printf("is also a vast  ");
00036         lcd.printf("cookbook online ");
00037         wait(3);
00038 
00039         lcd.printf("where you can   ");
00040         lcd.printf("find lots of    ");
00041         wait(3);
00042 
00043         lcd.printf("example code to ");
00044         lcd.printf("experiment with ");
00045         wait(3);
00046 
00047         lcd.printf("to create       ");
00048         lcd.printf("programs like   ");
00049         wait(3);
00050 
00051         lcd.printf("this one in     ");
00052         lcd.printf("minutes!        ");
00053         wait(3);
00054 
00055         lcd.printf("                ");
00056         lcd.printf("                ");
00057         wait(3);
00058 
00059         lcd.printf("Temp is:        ");
00060         lcd.printf("%.1f degrees C\n", temperature.read()) ;
00061         wait(3);
00062 
00063     }
00064 }