Lin Team / Mbed 2 deprecated LORA_RA_L475VG

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

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 }