I ran the example code provided in the Processing wiki.
http://code.google.com/p/xbee-api/wiki/Processing
I got the following error that suggested enabling API mode.
XBee failed to initialize
com.rapplogic.xbee.api.XBeeException: AT command timed-out while
attempt to set/read in API mode. The XBee radio must be in API mode
(AP=2) to use with this library
at com.rapplogic.xbee.api.XBee.doStartupChecks(XBee.java:124)
at com.rapplogic.xbee.api.XBee.initConnection(XBee.java:170)
at com.rapplogic.xbee.api.XBee.open(XBee.java:142)
at sketch_feb20a.setup(sketch_feb20a.java:73)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
So, I added the following line of code to enable API mode only to get
the same error mentioned above.
xbee.sendAtCommand(new AtCommand("AP", 2));
Is it a connection problem with the XBees or am I missing something on
the coding side?