Code APP3
Dependencies: mbed EthernetInterface WebSocketClient mbed-rtos BufferedSerial
Fork of APP3_Lab by
main.cpp
- Committer:
- Cheroukee
- Date:
- 2017-09-30
- Revision:
- 6:9ed8153f1328
- Parent:
- 5:9e6a09a38785
- Child:
- 8:5955af1ee445
File content as of revision 6:9ed8153f1328:
#include "mbed.h" #include "xbee.h" #include "parser.h" #define IS_COORDINATOR 1 #define PAN_ID 0xC0FFEE Serial pc(USBTX, USBRX); // tx, rx char recv_buff[2048] = {0}; int main() { ReadFile(); xbee_init(); char c; char hello_world[12] = "Hello world"; #if IS_COORDINATOR #else DECLARE_ADDR64_COORD DECLARE_ADDR16_UNKNOWN_OR_BCAST transmit_request(hello_world, 11, 0, USE_ADDR64_COORD, USE_ADDR16_UNKNOWN_OR_BCAST); #endif while(1) { /*if (pc.readable()) { c = pc.getc(); xbee.putc(c); //pc.putc(c); }*/ int recv_len = receive(recv_buff, 2048); if (recv_len > 0) { pc.printf("DATA RECEIVED : "); for (int i = 0; i < recv_len; i++) { pc.putc(recv_buff[i]); } pc.printf("\n\r"); } } }