Pages: [1]   Go Down
Author Topic: Arduino BT + SuperWaba  (Read 273 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everybody!

I'm trying to connect an Arduino BT board to a SuperWaba app on a PocketPc. Everything seems to work fine: I can see the BT connection in the BT connections list in XP.

The problem comes when I try to send data (from the SW to ABT). The SW app consists of a group of buttons. I pretend to send some integers to the board everytime that a button is pressed. Seeing that it does not work, I've simplified it so all the buttons do the same task: send a 0 to the board. If the board receives data it is supposed to change the state of a LED (if turned on -> turns it off; if turned off -> turns it on).

The fact is that the board is receiving data, cause some times the LED changes. The main problem is that it NOT always happens. And I haven't noticed a pattern.

Does anybody know why can this be happening? Anything about problems between different protocol (SW - ABT) communications? Anything related to reliability of the BT communications in Arduino (I suppose it has to be reliable...)?

Here's the Arduino code:

//***************************************

int redPin   = 11;
int op=-2;
int X=0;

void setup() {
  pinMode(redPin,   OUTPUT);
  Serial.begin(115200);
  long time = millis();
  randomSeed(time);

  // Reset the bluetooth interface
  digitalWrite(RESET, HIGH);
  delay(10);
  digitalWrite(RESET, LOW);
  delay(2000);
  //configure the bluetooth module
  Serial.println("SET BT PAGEMODE 3 2000 1");
  Serial.println("SET BT NAME BTLAMP");
  Serial.println("SET BT ROLE 0 f 7d00");
  Serial.println("SET CONTROL ECHO 0");
  Serial.println("SET BT AUTH * 12345");
  Serial.println("SET CONTROL ESCAPE - 00 1");
}

void loop () {

  Serial.flush();
  op=Serial.read();

  if (op!=-1) {
    if(X==255) X=0;
    else X=255;
    analogWrite(11, X);
  }
}

//***************************************

Thanks in advance!!!
Logged

Pages: [1]   Go Up
Jump to: