[SOLVED] Problems sending data from Processing to Arduino through serial port

Hello,

I have done similar with BlueTooth (serial over BT) modules.

The first thing I do is make sure the code works connecting PC directly to Arduino using the USB serial.
If this serial communication works then adapt the code (just change the serial ports) to work with Blue Tooth serial and in your case XBEE serial.

The challenge is to configure the hardware correctly and then test the serial communications (USB serial first and then BT or XBEE serial).

I have a lot of serial to USB modules I can use with the additional Arduino serial ports (Serial 1, 2, and 3 on my Mega 2560) to communicate with PC (serial USB) as monitors\listeneners; these come in handy. If you don’t have these you can light up LEDs or use LCD displays as a data monitor during initial testing.
I often use a serial monitor\listener and that can be the Arduino monitor, other terminal software or even another Processing sketch.

I see that you are using software serial which also works.

You can also send data back using the same serial port; I usually do not do this as it can complicate code and troubleshooting.

I am assuming:

Xbee (serial) on PC
XBee (serial) on Arduino
USB(serial) on Arduino used to monitor received data.

Try these:
image

This is a “fix” for SimpleWrite example:

The Arduino code is in the examples in the Processing IDE and here:

This came in handy when I was setting this up:

:)

1 Like