4 Replies - 569 Views - Last Post: 14 January 2009 - 08:31 PM Rate Topic: -----

#1 pork  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 15-December 08

i can't seem to trigger all my zigbees LEDs for this program

Post icon  Posted 13 January 2009 - 06:12 PM

Help i can't seem to trigger all my zigbees LEDs for this program. It only triggers one What must i add in the code to trigger all of them? I've tried adding more MacAddress but i it only takes the latest macaddress of the zigbee

private void btnled_Click(object sender, EventArgs e)
		{
			ReadTemp.Enabled = false;
			timer2.Enabled = false;
			timer1.Enabled = true;
			if (checkBox1.Checked)
			{
				for (int j = 0; j < NodeIDList.Items.Count; j++)
				{				 
					  
					MAddr = NodeIDList.Items[j].ToString(); 

					MAddr = "000D6F0000166D32";
 
					byte[] IDRight = Encoding.ASCII.GetBytes(MAddr);	   

					byte[] serialData = new byte[32];//Declare NO. of byte

					//Send command to turn on LED			
					serialData[0] = 0x41;//A
					serialData[1] = 0x54;//T				   
					serialData[2] = 0x52;//R
					serialData[3] = 0x45;//E
					serialData[4] = 0x4D;//M
					serialData[5] = 0x53;//S				 
					serialData[6] = 0x3A;//:

					int bytes = port1.BytesToWrite;

					for (int i = 0; i <= 15; i++)
					{			 
						serialData[i + 7] = IDRight[i + 0];
					}			  

					serialData[23] = 0x2C;//,
					serialData[24] = 0x31;//1
					serialData[25] = 0x38;//8
					serialData[26] = 0x3D;//=
					serialData[27] = 0x30;//0
					serialData[27] = 0x30;//0
					serialData[29] = 0x30;//0
					serialData[30] = 0x30;//0
					serialData[31] = 0x0D;//Enter


					port1.Write(serialData, 0, 32);
				}

				btnsetup.Enabled = true;
				btnrefresh.Enabled = true;

}


View Postpork, on 13 Jan, 2009 - 05:09 PM, said:

Help i can't seem to trigger all my zigbees LEDs for this program. It only triggers one What must i add in the code to trigger all of them? I've tried adding more MacAddress but i it only takes the latest macaddress of the zigbee


private void btnled_Click(object sender, EventArgs e)
		{
			ReadTemp.Enabled = false;
			timer2.Enabled = false;
			timer1.Enabled = true;
			if (checkBox1.Checked)
			{
				for (int j = 0; j < NodeIDList.Items.Count; j++)
				{				 
					  
					MAddr = NodeIDList.Items[j].ToString(); 

					MAddr = "000D6F0000166D32";
 
					byte[] IDRight = Encoding.ASCII.GetBytes(MAddr);	   

					byte[] serialData = new byte[32];//Declare NO. of byte

					//Send command to turn on LED			
					serialData[0] = 0x41;//A
					serialData[1] = 0x54;//T				   
					serialData[2] = 0x52;//R
					serialData[3] = 0x45;//E
					serialData[4] = 0x4D;//M
					serialData[5] = 0x53;//S				 
					serialData[6] = 0x3A;//:

					int bytes = port1.BytesToWrite;

					for (int i = 0; i <= 15; i++)
					{			 
						serialData[i + 7] = IDRight[i + 0];
					}			  

					serialData[23] = 0x2C;//,
					serialData[24] = 0x31;//1
					serialData[25] = 0x38;//8
					serialData[26] = 0x3D;//=
					serialData[27] = 0x30;//0
					serialData[27] = 0x30;//0
					serialData[29] = 0x30;//0
					serialData[30] = 0x30;//0
					serialData[31] = 0x0D;//Enter


					port1.Write(serialData, 0, 32);
				}

				btnsetup.Enabled = true;
				btnrefresh.Enabled = true;
}




Sry abt the first post...

** Corrected for legibility **

Is This A Good Question/Topic? 0
  • +

Replies To: i can't seem to trigger all my zigbees LEDs for this program

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: i can't seem to trigger all my zigbees LEDs for this program

Posted 13 January 2009 - 06:17 PM

Type it a little bigger next time...I had a hard time seeing it.

why are you doing this?

MAddr = NodeIDList.Items[j].ToString(); 

MAddr = "000D6F0000166D32";



You are getting the MAC address from the list, but then you are overwriting it. That is why it's only happening for one LED. I bet you that the only LED that is working is the one with the MAC address as "000D6F0000166D32"
Was This Post Helpful? 0
  • +
  • -

#3 pork  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 15-December 08

Re: i can't seem to trigger all my zigbees LEDs for this program

Posted 13 January 2009 - 11:02 PM

View Posteclipsed4utoo, on 13 Jan, 2009 - 05:17 PM, said:

Type it a little bigger next time...I had a hard time seeing it.

why are you doing this?

MAddr = NodeIDList.Items[j].ToString(); 

MAddr = "000D6F0000166D32";



You are getting the MAC address from the list, but then you are overwriting it. That is why it's only happening for one LED. I bet you that the only LED that is working is the one with the MAC address as "000D6F0000166D32"


yeah 000D6F0000166D32 mac address is the only one working...hmmm any ideas how to get the rest of the mac addresses?
Was This Post Helpful? 0
  • +
  • -

#4 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: i can't seem to trigger all my zigbees LEDs for this program

Posted 14 January 2009 - 05:52 AM

View Postpork, on 14 Jan, 2009 - 01:02 AM, said:

yeah 000D6F0000166D32 mac address is the only one working...hmmm any ideas how to get the rest of the mac addresses?


MAddr = NodeIDList.Items[j].ToString(); 

//MAddr = "000D6F0000166D32";


Was This Post Helpful? 0
  • +
  • -

#5 pork  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 15-December 08

Re: i can't seem to trigger all my zigbees LEDs for this program

Posted 14 January 2009 - 08:31 PM

View Posteclipsed4utoo, on 14 Jan, 2009 - 04:52 AM, said:

View Postpork, on 14 Jan, 2009 - 01:02 AM, said:

yeah 000D6F0000166D32 mac address is the only one working...hmmm any ideas how to get the rest of the mac addresses?


MAddr = NodeIDList.Items[j].ToString(); 

//MAddr = "000D6F0000166D32";


ok thkx =)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1