Using Processing to Control BlueSmirf Bluetooth---Huge Lag

Hi, I'm using processing on a windows 7 machine to send commands to my BlueSmirf modem on my Arduino 0022. Right now I am simply trying to use a keystroke to turn on an LED. The program works fine when I used it on a macbook pro earlier today, but when the commands are coming from my computer there is a 10 second lag in between when I hit the key and when the LED lights up. Has anyone else had problems with this? I wasn't able to find anything on the internet. Thanks.

The program works fine when I used it on a macbook pro earlier today, but when the commands are coming from my computer there is a 10 second lag in between when I hit the key and when the LED lights up.

Isn't the macbook pro a computer? Are we to presume that your computer is NOT a macbook pro? If so, what OS is it running?

What does the Processing sketch look like? What does the Arduino sketch look like? Which model Arduino is the 0022? I've never heard of that model.

i'm running windows 7 the arduino is the nano v3 running the arduino 0022 software...http://www.arduino.cc/en/Main/Software

arduino code:

// global variables int message = 0; // variable to receive data from the serial port int ledpin = 8; // LED connected to pin 48 (on-board LED)

//--- Function: Setup () void setup() { pinMode(ledpin, OUTPUT); // pin 48 (on-board LED) as OUTPUT Serial.begin(9600); // start serial communication at 9600bps }

//--- Function: loop () void loop() { if( Serial.available() > 0 ) // if data is available to read { message = Serial.read(); // read it and store it in 'val' if( message == 'R' ) // if 'R' was received { digitalWrite(ledpin, HIGH); // turn ON the LED } else if (message == 'r') { digitalWrite(ledpin, LOW); // otherwise turn it OFF } }

delay(100); // wait 100ms for next reading }

processing code:

import processing.serial.*; // Load serial library Serial arduinoPort; // Set arduinoPort as serial connection

//--- Function: setup void setup() { //set up windowh size(200, 200); noStroke();

// List all the available serial ports in the output pane. // You will need to choose the port that the Wiring board is // connected to from this list. The first port in the list is // port #0 and the third port in the list is port #2. println(Serial.list());

// Open the port that the Wiring board is connected to (in this case 1 // which is the second open port in the array) // Make sure to open the port at the same speed Wiring is using (9600bps) arduinoPort = new Serial(this, Serial.list()[4], 9600);

}

//--- Function: draws background and rectangles void draw() { background(255); //Turn LED on and off if buttons pressed where //R = on (high) and r = off (low) if(keyPressed == true) { arduinoPort.write('R'); println("on"); fill(0); } else { arduinoPort.write('r'); println("off"); fill(255); } rect(25, 25, 50, 50);

}

astronaut,

Have you had any luck finding out what is up with the delay? I'm running Vista, Arduino Duemilanove, BlueSMiRF silver and having the same issues.

One thing I'd like to note though, is that I don't have any delay issues when I use my Android phone to talk to the Arduino.

I'm thinking that it's on the side of Processing that is having issues.