Closed HamAndEggs closed 8 years ago
Can you please confirm that you are using the following:
Also, which board are you using (Atmel 32U4 or ATSAMD21 based)?
Hi, this was fixed a while ago. Not sure why the bug was not closed. Was dealt with on the forums. There was a typo in the function and was fixed.
Ta. :)
If you call peek then it's game over, read will not work.
Here is a use case, I have altered the loop from the bleuart_datamode example. All I done is add a peek() before the read() call and it breaks the app.
void loop(void) { // Check for user input char n, inputs[BUFSIZE+1];
if (Serial.available()) { n = Serial.readBytes(inputs, BUFSIZE); inputs[n] = 0; // Send characters to Bluefruit Serial.print("Sending: "); Serial.println(inputs);
}
// Echo received data while ( ble.available() ) { int x = 'x'; // x = ble.peek(); // !!!!! Uncomment this line and the app breaks !!!!! int c = ble.read();
} }