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.
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 #include <string> 00003 00004 Serial pc(USBTX, USBRX); 00005 Serial uart(PA_0, PA_1);//TX4,RX4 00006 int idx=0; 00007 string inputdata; 00008 00009 void newData() 00010 { 00011 char ch; 00012 while (uart.readable()) { 00013 ch = uart.getc(); 00014 if (ch == 's') { 00015 inputdata.clear(); 00016 } 00017 inputdata += ch; 00018 if (ch == '#') { 00019 inputdata.erase(0,1); 00020 inputdata.erase(inputdata.length()-1,1); 00021 pc.printf("%s\n\r",inputdata); 00022 wait(0.01); 00023 } 00024 //pc.printf("wwwwwww"); 00025 00026 } 00027 } 00028 00029 int main() 00030 { 00031 00032 uart.baud(9600); 00033 uart.attach(&newData); 00034 while(1) { 00035 00036 00037 } 00038 }
Generated on Tue Aug 23 2022 20:17:12 by
1.7.2