Dependencies:   mbed

Committer:
simon
Date:
Mon Nov 30 09:32:28 2009 +0000
Revision:
0:42626fc1bbc5

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 0:42626fc1bbc5 1 // example showing how to re-route stdout, sford
simon 0:42626fc1bbc5 2
simon 0:42626fc1bbc5 3 #include "mbed.h"
simon 0:42626fc1bbc5 4 #include "TextLCD.h"
simon 0:42626fc1bbc5 5
simon 0:42626fc1bbc5 6 Serial pc(USBTX, USBRX, "hi");
simon 0:42626fc1bbc5 7 TextLCD lcd(p10, p11, p12, p15, p16, p29, p30, "lcd"); // rs, rw, e, d0-d3, name
simon 0:42626fc1bbc5 8 LocalFileSystem local("local");
simon 0:42626fc1bbc5 9
simon 0:42626fc1bbc5 10 int main() {
simon 0:42626fc1bbc5 11 // printf to specific peripherals
simon 0:42626fc1bbc5 12 pc.printf("Hello World!\n");
simon 0:42626fc1bbc5 13 lcd.printf("Hello World!\n");
simon 0:42626fc1bbc5 14
simon 0:42626fc1bbc5 15 // printf to stdout
simon 0:42626fc1bbc5 16 printf("Hello USB Serial World!\n");
simon 0:42626fc1bbc5 17
simon 0:42626fc1bbc5 18 // change stdout to file
simon 0:42626fc1bbc5 19 freopen("/local/output.txt", "w", stdout);
simon 0:42626fc1bbc5 20 printf("Hello FileSystem World!\n");
simon 0:42626fc1bbc5 21 fclose(stdout);
simon 0:42626fc1bbc5 22
simon 0:42626fc1bbc5 23 // change stdout to LCD
simon 0:42626fc1bbc5 24 freopen("/lcd", "w", stdout);
simon 0:42626fc1bbc5 25 printf("Hello LCD World!\n");
simon 0:42626fc1bbc5 26 fclose(stdout);
simon 0:42626fc1bbc5 27
simon 0:42626fc1bbc5 28 wait(5);
simon 0:42626fc1bbc5 29
simon 0:42626fc1bbc5 30 pc.printf("Hello World!\n");
simon 0:42626fc1bbc5 31 lcd.printf("Hello World!\n");
simon 0:42626fc1bbc5 32 }