... | ... | @@ -92,16 +92,10 @@ void loop() { |
|
|
c[0] = (char) SerialBT.read();
|
|
|
c[1] = '\0';
|
|
|
|
|
|
if(c[0] == '\r' || c[0] == '\n'){ // detect crlf (\r \n)
|
|
|
|
|
|
if(// detect crlf (\r \n)
|
|
|
(
|
|
|
c[0] == '\r'
|
|
|
|| // OR
|
|
|
c[0] == '\n'
|
|
|
)
|
|
|
&& // AND
|
|
|
buffer[0] != '\0' // check if buffer is not empty
|
|
|
){
|
|
|
// check if the buffer is empty
|
|
|
if(buffer[0] == '\0') return;
|
|
|
|
|
|
Serial.println(buffer);
|
|
|
exeCommande();
|
... | ... | @@ -124,7 +118,6 @@ void exeCommande() |
|
|
return;
|
|
|
}
|
|
|
|
|
|
//default
|
|
|
SerialBT.println("Unknow command");
|
|
|
}
|
|
|
``` |