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.
main.cpp
00001 // example showing how to re-route stdout, sford 00002 00003 #include "mbed.h" 00004 #include "TextLCD.h" 00005 00006 Serial pc(USBTX, USBRX, "hi"); 00007 TextLCD lcd(p10, p11, p12, p15, p16, p29, p30, "lcd"); // rs, rw, e, d0-d3, name 00008 LocalFileSystem local("local"); 00009 00010 int main() { 00011 // printf to specific peripherals 00012 pc.printf("Hello World!\n"); 00013 lcd.printf("Hello World!\n"); 00014 00015 // printf to stdout 00016 printf("Hello USB Serial World!\n"); 00017 00018 // change stdout to file 00019 freopen("/local/output.txt", "w", stdout); 00020 printf("Hello FileSystem World!\n"); 00021 fclose(stdout); 00022 00023 // change stdout to LCD 00024 freopen("/lcd", "w", stdout); 00025 printf("Hello LCD World!\n"); 00026 fclose(stdout); 00027 00028 wait(5); 00029 00030 pc.printf("Hello World!\n"); 00031 lcd.printf("Hello World!\n"); 00032 }
Generated on Thu Jul 14 2022 10:16:53 by
1.7.2