Niranjan Ravi / Mbed 2 deprecated MCUProgram

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 "math.h"
00003 #include <string.h>
00004 
00005 Serial pc(USBTX, USBRX);
00006 Serial sendingData(PTC17, PTC16);
00007 Serial receivingData(PTD3,PTD2);
00008 char        message[] = "coap CON GET fd61:7409:e1d2:56f2:587f:c682:5d9c:6951 /temp\n";
00009 char data[2];
00010 char command[80];
00011 
00012 int main()
00013 {
00014    pc.baud(115200);
00015    sendingData.baud(115200);
00016    receivingData.baud(115200);
00017    sendingData.printf("%s", message);
00018    while(1)
00019    {
00020        if (sendingData.readable())
00021         {
00022             sendingData.gets(command, 80);
00023         }   
00024        uint8_t i = command[64];
00025        uint8_t j = command[65];
00026        printf("%c" , i);
00027        printf("%c" , j);
00028        for(int k = 0; k < 1 ; k++)
00029        {
00030            data[k]=command[64];
00031            k++;
00032            data[k]=command[65];
00033        }     
00034        receivingData.puts(data); //FormatToSend  
00035     }  
00036     }
00037