Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 2 months ago.
how to make this receive code to send code?
this right now is the relay receive from the xbee. but i want the relay to send to the xbee. how to change it?
const char RelayCommand[3] = { 0xAB, 0x01, 0x99 }; if (xbee1.readable()) { byteIn = xbee1.getc(); if (byteCount < 3) { // still looking for the header if (byteIn == RelayCommand[byteCount]) byteCount++; else if (byteIn == RelayCommand[0]) byteCount = 1; else byteCount = 0; } else { // got the full header. if (byteIn == 0x01) { Relay = 1; pc.printf("on"); } else if (byteIn == 0x00) { Relay = 0; pc.printf("off"); } byteCount = 0; } } } }