program to send data to MCU xpresso

Dependencies:   mbed

main.cpp

Committer:
Niranjan_ravi
Date:
2019-05-02
Revision:
0:32ad1446eccf

File content as of revision 0:32ad1446eccf:

#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  
    }  
    }