Niranjan Ravi
/
MCUProgram
program to send data to MCU xpresso
Diff: main.cpp
- Revision:
- 0:32ad1446eccf
diff -r 000000000000 -r 32ad1446eccf main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 02 23:23:36 2019 +0000 @@ -0,0 +1,37 @@ +#include "mbed.h" +#include "math.h" +#include <string.h> + +Serial pc(USBTX, USBRX); +Serial sendingData(PTC17, PTC16); +Serial receivingData(PTD3,PTD2); +char message[] = "coap CON GET fd61:7409:e1d2:56f2:587f:c682:5d9c:6951 /temp\n"; +char data[2]; +char command[80]; + +int main() +{ + pc.baud(115200); + sendingData.baud(115200); + receivingData.baud(115200); + sendingData.printf("%s", message); + while(1) + { + if (sendingData.readable()) + { + sendingData.gets(command, 80); + } + uint8_t i = command[64]; + uint8_t j = command[65]; + printf("%c" , i); + printf("%c" , j); + for(int k = 0; k < 1 ; k++) + { + data[k]=command[64]; + k++; + data[k]=command[65]; + } + receivingData.puts(data); //FormatToSend + } + } +