I was sending those commands having the xbees attached to separate USB adapters and it worked flawlessly, the coordinator sends the frames and the router responds appropriately.
now the problem I am having is I wrote a arduino program to simply send those API frames via my Etherten to the coordinator that sits on top of a sparkfun xbee shield.
but it does nothing, I see the Din flashing on the xbee shield and Di05(associate) but the router is not getting anything and with the router plugged into a computer with X-CTU terminal monitoring open it shows no data coming in and the LED does not activate.
I have pasted my code below please if anyone can figure out what I have done wrong let me know
PaulS:
The values in the packet are binary values, not ASCII values, and there are no spaces between the values. Ditch the String class, now.
thank you for the reply mate.
what would you recommend in place of the string class and am I to transmit those frames in its binary format? because using xctu they go through just fine and work.
does that mean the byte class is too small for a array of that size?
byte isn't a class.
"call of overloaded 'print(byte[20]' is ambiguous"
means that there was one or more methods that are not an exact match for the call you are trying to make. The compiler then showed you some options. The most likely one that you want to use is the one where you admit that the compiler can't figure out when to stop sending data in the array without you telling it how big the array is. So, tell it how big the array is.
at first I tried making it step through the array index and that worked but it was unnecessarily complicated.
I had to use Serial.write(packet,20); instead as Serial.print(packet, 20) was still causing that problem.
//#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