by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Revision 0:c36ba3b21cbe, committed 2013-05-24
- Comitter:
- robt
- Date:
- Fri May 24 21:35:33 2013 +0000
- Commit message:
- by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Changed in this revision
diff -r 000000000000 -r c36ba3b21cbe MobileLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MobileLCD.lib Fri May 24 21:35:33 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/robt/code/MobileLCD/#39daa30e0eb3
diff -r 000000000000 -r c36ba3b21cbe main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 24 21:35:33 2013 +0000 @@ -0,0 +1,31 @@ +/*Program Example 8.8: Program which reads character from computer screen, and displays on Nokia LCD display. + */ +#include "mbed.h" +#include "MobileLCD.h" +MobileLCD lcd(p11, p12, p13, p15, p16); //mosi,miso,clk,cs,rst +Serial pc(USBTX, USBRX); // host terminal comms setup +char c; // char variable for keyboard input +void screen_setup(void); // function prototype + +int main() { + pc.printf("\n\rType something to be displayed:\n\r"); + screen_setup(); // call the screen setup function + while(1){ + c = pc.getc(); // c = character input from computer keyboard + wait(0.001); + if (c=='#'){ // perform the following if "#" is pressed + screen_setup(); // call the screen setup function + lcd.locate(0,0); // move the cursor back to row 0 column 0 + } + else{ + lcd.printf("%c",c); // print character on the LCD screen + pc.printf("%c",c); // print character on the terminal screen + } + } +} + +//function definition for screen_setup +void screen_setup(void) { + lcd.background(0x0000FF); // set the background colour + lcd.cls(); // clear the screen +}
diff -r 000000000000 -r c36ba3b21cbe mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri May 24 21:35:33 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da \ No newline at end of file