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, 3 months ago.
am i doing this correct?
sending the relay on/off to another device
DigitalOut Relay(PB_0); Serial xbee1(PB_6, PB_7); bool relayon = false; const char RelayCommand[3] = { 0xAB, 0x01, 0x99 }; void sendRelay(bool on) {for (int i = 0; i<3; i++) xbee1.putc(RelayCommand[i]); //send the relay status if (on) xbee1.putc(0x01); else xbee1.putc(0x00); // set/clear the flag indicating that the relay is in. relayon = on;}