Wireless programming modules and Processing

userHead DebianAddict 2014-03-04 00:05:20 1820 Views1 Replies
I am using a Processing interface to control a robot that I am making. I ordered the DFRobot wireless programming kit for arduino ([url=][/url]) and I went through configuring the modules successfully. I was able to upload code with the units directly from the arduino IDE successfully as well. I then went to test bringing processing into the mix with a simple program that I could debug easily. I uploaded this code onto the arduino board:

[code]char val; // Data received from the serial port
int ledPin = 13; // Set the pin to digital I/O 13

void setup() {
pinMode(ledPin, OUTPUT); // Set pin as OUTPUT
Serial.begin(38400); // Start serial communication at 9600 bps

void loop() {
if (Serial.available())
{ // If data is available to read,
val =; // read it and store it in val
if (val == '1')
{ // If 1 was received
digitalWrite(ledPin, HIGH); // turn the LED on
} else {
digitalWrite(ledPin, LOW); // otherwise turn it off
delay(10); // Wait 10 milliseconds for next reading

and then I started to run this processing sketch:

[code]import processing.serial.*;

Serial myPort; // Create object from Serial class

void setup()
size(200,200); //make our canvas 200 x 200 pixels big
myPort = new Serial(this, "COM5", 38400);

void draw() {
if (mousePressed == true)
{ //if we clicked in the window
myPort.write('1'); //send a 1
} else
{ //otherwise
println("0"); //send a 0
This works just fine over a hard wired serial bus, but when this is done over the wireless module, the LINK light stays on when the processing sketch is running and nothing happens. Can anyone tell me what I need to do to my code or my hardware to make this work.
2014-03-04 15:58:38 Hello,
I guess the problem caused by the baud rate.
It is better to use the same baud rat (sketch 1 and two WPM modules).
userHeadPic Grey.CC