Go Down

Topic: Reliable response using SET command (Read 349 times) previous topic - next topic

beats_squared

I'm using the Arduino Bluetooth board to pair/store the addresses of known devices in EEPROM. I've been trying to use the SET command to echo the settings of the BlueGiga radio, but the response is incomplete; specifically in the SET BT PAIR field, which is exactly what I need. Sometimes the complete pairing information appears, other times the addresses are simply cut off partway through, or do not appear at all. In all cases, the first paired device does not even appear.

Has anyone gotten reliable output using the SET command? If so, how did you implement it? My serial read routine is working correctly and this command seems to be the only one that is giving me trouble. Thanks.

Here's a code snippet:


 int j=eeprom_scratch_idx;
 char tmp_b;

 digitalWrite(ledPin, HIGH); // set led HIGH
 delay(2000);  
 Serial.print("+++");
 delay(2000);

 Serial.println("SET");
   
 for (int i=0; i <= 10; i++){
   delay(1000);
   while (Serial.available() > 0 && j <512) {  
        //inByte = getbyte();  // get incoming byte
        //EEPROM.write(j, inByte);
        tmp_b = getbyte();
          EEPROM.write(j,tmp_b);
          j++;
   }
   delay(1000);
 }

 delay(2000);
 Serial.print("+++");
 delay(2000);

Go Up