Home/Support/Support Forum/How can i sent API frame to XBee (S2) Router using VisualStudio C#
New and improved user forum site coming soon

How can i sent API frame to XBee (S2) Router using VisualStudio C#

0 votes
How do i sent API frames to XBee Router Via C# program. I have been trying to find samples or tutorial online to get me started but to no avail.

SerialPort port = new SerialPort("COM4", 9600, Parity.None, 8, StopBits.One);
port.DataReceived += new SerialDataReceivedEventHandler(SerialPort_DataReceived);

port.DtrEnable = true;
port.RtsEnable = true;
byte[] buffer = new byte[1024];

This code is all ive found but it is only to open my coordinator Xbee port( I think) How do i sent API frame and get a reading from it?
Help greatly appreciated! Thank you
asked Jun 25, 2014 in RF Solutions and XBee by AwStranger New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
this is the mode that I send comands API for other xbee in C#

private void button11iron_Click(object sender, EventArgs e)

byte[] bytesToSend5 = new byte[] { 0x7E, 0x00, 0x11, 0x17, 0x01, 0x00, 0x13, 0xA2, 0x00, 0x40, 0x49, 0xA0, 0xEB, 0xFF, 0xFE, 0x02, 0x49, 0x52, 0x01, 0xF4, 0x8F};
Comport.Write(bytesToSend5, 0, bytesToSend5.Length);

textBox2.Text = "TX: 7E 00 11 17 01 00 13 A2 00 40 49 A0 EB FF FE 02 49 52 01 F4 8F";
textBox2.ForeColor = Color.Green;
catch (Exception ex)
MessageBox.Show(ex.Message, "Erro no Comando !", MessageBoxButtons.OK, MessageBoxIcon.Stop);

change your adress zigbee. int this case i send the comand IR
that sends values ​​of samples every 500 milliseconds
answered Jul 1, 2014 by engereggae New to the Community (3 points)
edited Jul 1, 2014 by engereggae
hello can you explain more the exact location of the 16 bit address in your byte array , my xbee receiver has address of 02

where do i key in this - thanks in advance