Hi there !
In my project of an MIT/Arduino photo Focus Stacking machine, I need to enter a motor step value.
I then chose in MIT a "text box" to manually write what I need.
I managed to do what I want.
However, in testing, when I write/delete/rewrite several times quickly, I sometimes get unwanted values.
For example at some point I will write "975" , and the value received in Arduino serial monitor is 875... (afterwards when I type another value, it returns to normal.)
At another point, I will write for example "653", and the received value is "6A3" (or sometimes with weird sign).
What do you think?
I'm quite a beginner. There is probably some information missing, don't hesitate to ask me.
I post pictures of information that seems useful to me.
Thanks in advance!
[I use Google translate]
if(bluetooth.available()){ // Si Bluetooth recois qql ch
messageRec = bluetooth.read(); // lire le message recus et le stocker dans variable messageRec
if (messageRec=='$'){ //
arretTemps = 1; //Arrêt envoye bluethoot position moteur XYZR toute les 100mili.s //
boucleString = 1; //
stringBtPas=""; // rénitialisation stringBtPas, a chaque nouvelle entrer sur MIT //
} //
//
if (boucleString==1){ //
stringBtPas = stringBtPas + messageRec; //
Serial.print("stringBtPas = "); //
Serial.println(stringBtPas); //
} //
//
if (messageRec=='*'){ //
stringBtPas = stringBtPas.substring(1, stringBtPas.length()-1); //
//Serial.print("stringBtPas* = "); //
//Serial.println(stringBtPas); //
nmbPas=stringBtPas.toInt(); //
Serial.print("nmbPas = "); //
Serial.println(nmbPas); //
arretTemps = 0; //Reprise envoye bluethoot position moteur XYZR toute les 100mili.s //
} //
//
//----------------------------------------------------------------------------------------//
} // Fin BT```