Good Code for XBee?

by wnc on Wed May 23, 2012 9:46 am

Hi

I found a very good code for RF module. It is simple but very robust. If you are interested, see the link below:
http://www.glacialwanderer.com/hobbyrobotics/?p=291

Now I tried to use this code with my XBee 2 series and it doesn't work. I know that setting of the Xbee are correct because when I use different simple code , it works. So basically, no XBee setting problem at all.

Anybody have any idea why this code doesn't work with XBee 2 and any solution? Will it work with XBee 1(that I don't have)?

I wanted to use XBee for my project but the code I know is not stable. Project is simple to control the LED at the other side. The code in the "Wireless Sensor Networks" and "Arduino Cookbook" are simple and not stable. Anybody have more robust code to control a LED like the one shown in the link.

Thanks
wnc
 
Posts: 38
Joined: Tue May 08, 2012 8:16 am

Re: Good Code for XBee?

by franklin97355 on Wed May 23, 2012 11:36 am

You need to modify the code to use xbee. You also need to configure the modules, have you done that? The Adafruit series1 modules are different than the series2 so code found here might not work in your case.
User avatar
franklin97355
 
Posts: 4372
Joined: Mon Apr 21, 2008 1:33 pm

Re: Good Code for XBee?

by wnc on Wed May 23, 2012 8:29 pm

Thanks franklin for your comments.
As I said earlier, I have configure the module and it is correct that it works with different code.
To modify the code to use xbee, I cannot find the code to modify based on my knowledge. Because both module (RF & xbee) do not need any library and use serial port to transmit/receive data.
When I use simple code to test, both are working. But not this code.
If anybody found the solution, please let me know.

Thanks
wnc
 
Posts: 38
Joined: Tue May 08, 2012 8:16 am

Re: Good Code for XBee?

by franklin97355 on Wed May 23, 2012 10:31 pm

Anybody have more robust code to control a LED
What is not robust about the code you have tried?
User avatar
franklin97355
 
Posts: 4372
Joined: Mon Apr 21, 2008 1:33 pm

Re: Good Code for XBee?

by wnc on Thu May 24, 2012 3:12 am

franklin
The code I have tried is simple and works. those are from the book I mentioned earlier.
However transmitted data lost in transit sometime. Therefore data exchange is not reliable.
But the code in the link is relatively more reliable. Unfortunately it doesn't work with xbee 2.
wnc
 
Posts: 38
Joined: Tue May 08, 2012 8:16 am

Re: Good Code for XBee?

by faludi on Thu May 31, 2012 3:46 pm

You shouldn't be losing data at all, especially with XBees that are paired together properly, at a reasonable range from each other and with a clean power source (the Arudino's 3.3 output pin should be pretty clean.

Try the code in Building Wireless Sensor Networks for the Doorbell project. It is extremely simple and relies on the XBee's transparent mode to behave essentially like a serial cable connection. Also check your radios in X-CTU to make sure that you have the latest version of the firmware. Your Series 2 might have shipped with a very early version and a lot of improvements have been made that you'll certainly want to have.
faludi
 
Posts: 23
Joined: Thu Jul 17, 2008 2:58 pm

Re: Good Code for XBee?

by Forrestaf on Mon Jun 11, 2012 4:43 am

wnc wrote:The code I have tried is simple and works. those are from the book I mentioned earlier.
However transmitted data lost in transit sometime.

Then you should check the code - may be there's an error somewhere.
Forrestaf
 
Posts: 1
Joined: Mon Jun 11, 2012 4:38 am