hi Capper
I want to intergrate XBEE communications through the webserver. Just one xbee to remote control 4 relays.
I have a working sketech that can remotely control the XBEEs using API commands but I want to know what section of the webserver would be appropriate to insert the xbee controls in.
I was thinking in place of having the buttons control pins on the arduino, the webserver directly dispatches the appropriate API commands to remotely control the relays. the code I have pasted below just toggles pin D1 on the remote xbee on and off. I want to be able to do that with this webserver.
//#include <Wire.h>
//frame for router D1 on
byte Router_on[] = {0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0x79,0x5F,0x90,0xFF,0xFE,0x02,0x44,0x31,0x05,0x11};
//Frame for router D1 off
byte Router_off[] ={0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0x79,0x5F,0x90,0xFF,0xFE,0x02,0x44,0x31,0x04,0x12};
void setup()
{
Serial.begin(9600);
delay(5000);//delay of 5 seconds to ensure router and coordinator are joined to each other
//delay not entirely necessary
}
void loop(){
//after various trials serial.print(Router_on,20); kept causing the overloaded ambiguous error
//Serial.write(Router_on,20); does it with no problems
//the 20 tells the compiler how long the array is
//Thank you PaulS from the Arduino forum for helping with this
Serial.write(Router_on, 20);
delay(2000);
Serial.write(Router_off, 20);
delay(2000);
}
also do you have any tips on how to reduce the latency with the buttons on the web app and actually controlling the pins on the arduino? what is causing the latency?
Thank you.