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 #include "mbed.h" 00002 00003 DigitalOut myled(LED1); 00004 #define acm 1 00005 00006 #if acm==1 00007 Serial serial(USBTX, USBRX); 00008 #endif 00009 00010 void print_stng(char *stng) // operate at low priority 00011 { 00012 #if acm == 0 00013 printf( "%s",stng); 00014 #else 00015 serial.printf( "%s",stng); 00016 #endif 00017 } 00018 00019 char stng[300]; 00020 int pass; 00021 int main() { 00022 pass=0; 00023 wait(2.0); 00024 #if acm == 1 00025 serial.baud(115200); // set baude rate if serial port 00026 #endif 00027 wait(2.0); 00028 while(1) { 00029 sprintf(stng,"printstring 1 %d \r\n",pass++); 00030 print_stng(stng); 00031 myled = 1; 00032 wait(2.0); 00033 sprintf(stng,"printstring 2 %d \r\n",pass++); 00034 print_stng(stng); 00035 myled = 0; 00036 wait(2.0); 00037 } 00038 } 00039 00040 /* 00041 here is the crazy output of minicom set to 115200 baud on a Ubuntu linux systems 00042 prinsting 0 00043 printstring 2 1 00044 pristring 1 2 00045 pritstring 2 3 00046 pristring 1 00047 printstring 5 00048 printstring 1 6 00049 printstng 2 7 00050 �ά��߬ 00051 00052 �ά��ߍ 00053 J8�ά 00054 ά�ϬZ8printsri 00055 prinstr 2 15 00056 printstring 1 16 00057 printstring 2 17 00058 printstring 1 18 00059 printstring 2 19 00060 printstring 1 20 00061 printstring 2 21 00062 printstring 1 22 00063 printstring 2 23 00064 printstring 1 24 00065 printstring 2 25 00066 printstring 1 26 00067 printstring 2 27 correct from here on 00068 */ 00069
Generated on Thu Aug 4 2022 10:43:38 by
1.7.2