Go Down

Topic: [solved] XBee library crashes? (Read 638 times) previous topic - next topic


Nov 26, 2013, 09:05 am Last Edit: Nov 26, 2013, 07:26 pm by memel182 Reason: 1
Hello everyone,

Here is the simple code I am trying to test, but seems to make my ATmega2560 stop executing :

Code: [Select]

include "XBee.h";

XBee xbee;

setup() {
xbee = XBee();
pinMode(31, OUTPUT);

loop {

The main XBee (coordinator) is working great (tested with X-CTU) and directly wired to VCC/Ground of the board, with TX to the RX1 of the board (for Serial1), and communication with another XBee (router) is ok (associated and receiving).

So with this code, a LED wired to pin 31 of the mega is correctly blinking until I power up the router... As soon as the coordinator starts receiving datas, the code stops executing, the LED is not blinking anymore...

Any idea why this is happening?



That code does not compile.
Please post the code you are actually running.
Copy-and-paste is a good approach.


Code: [Select]
xbee = XBee();
You NEVER invoke the constructor directly. Get rid of this. You have already indirectly (correctly) invoked the constructor, here:
Code: [Select]
XBee xbee;
The art of getting good answers lies in asking good questions.


Awesome PaulS!

This seemed to cause the problem! I cleaned up my code starting from your suggestion and it worked!
I think I have to dive deeper in C++ syntax and leave some of my Java habits...

Anyway, great thanks!

Go Up