hi everyone,
i am writing a program on ZigBee using Microsoft visual Studio 2005 C#. But currently i couldn't get the result i desired. I was able to establish PAN and scan for node, but i couldn't get my node to read temperature, sound the buzzer and ON/OFF the LEDs. So if possible, can anyone out there please help me check and recorrect my program. Thanks, your help is truely appreciated.
using System;
using
namespace
{
InitializeComponent();
InitializeComports();
btnrefresh.Enabled =
btnsend.Enabled =
btnclear.Enabled =
button1.Enabled =
}
cmbcom.Items.Clear();
cmbcom.Items.Add(s);
port1.Close();
port1.PortName = cmbcom.Text;
port1.BaudRate =
port1.Parity =
port1.DataBits = 8;
port1.Open();
serialData[0] = 0x41;
serialData[1] = 0x54;
serialData[2] = 0x2B;
serialData[3] = 0x45;
serialData[4] = 0x4E;
serialData[5] = 0x0D;
port1.Write(serialData, 0, 6);
btnsetup.Enabled =
serialData[3] = 0x4E;
serialData[4] = 0x0D;
port1.Write(serialData, 0, 5);
btnpan.Enabled =
timer1.Enabled =
timer2.Enabled =
serialData[3] = 0x53;
serialData[3] = 0x49;
serialData[4] = 0x44;
serialData[5] = 0x45;
serialData[6] = 0x4E;
serialData[7] = 0x54;
serialData[8] = 0x3A;
serialData[i + 9] =
serialData[26] = 0x0D;
port1.Write(serialData, 0, 27);
serialData[2] = 0x53;
serialData[3] = 0x52;
serialData[4] = 0x45;
serialData[5] = 0x4D;
serialData[6] = 0x30;
serialData[7] = 0x46;
serialData[i + 9] = IDRight[i+1];
serialData[25] = 0x3D;
serialData[26] = 0x30;
serialData[27] = 0x30;
serialData[28] = 0x30;
serialData[29] = 0x30;
serialData[30] = 0x0D;
port1.Write(serialData, 0, 31);
serialData[3] = 0x44;
serialData[4] = 0x41;
serialData[5] = 0x53;
serialData[6] = 0x53;
serialData[7] = 0x4C;
serialData[8] = 0x0D;
port1.Write(serialData, 0, 9);
btnexit.Enabled =
port1.WriteLine(txtcmd.Text);
txtcmd.Text =
txtmsg.Text =
NodeIDList.Text =
port1.Read(buffer, 0, bytes);
txtmsg.Text += ByteArrayToAsciiString(buffer) +
sb.Append(
textBox0.Text += ByteArrayToAsciiString(buffer) +
textBox00.Text = field[1];
NodeIDList.Text += textBox00.Text;
txtmsg.Text = txtmsg.Text + textBox0.Text;
txttemp.Text=
serialData[6] = 0x31;
serialData[7] = 0x33;
serialData[25] = 0x3F;
serialData[i + 9] = IDRight[i + 1];
serialData[28] = 0x46;
txtmsg.SelectionStart = txtmsg.TextLength;
txtmsg.ScrollToCaret();
txttemp.Text =
serialData[3] = 0x4A;