TalkBack string newCommand?
Afficher commentaires plus anciens
TalkBack not work for ON/OFF LED with ESP8266, because wrong use for string newCommand
int z = newCommand.length();
then
compare z with 17 for TURN_ON and
compare z with 18 for TURN+OFF
for nothing new z=5
if( z > 5){
if(z == 17){
digitalWrite(LED_BUILTIN, LOW);
Serial.println("LED_ON");
}
if(z == 18){
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("LED_OFF");
}
}
else{
Serial.println(" Nothing new.");
}
Réponses (1)
ASSET
le 28 Mai 2023
0 votes
Solution is this: if(newCommand.length() != 0) Serial.print ("Latest command from queue: “); Serial.printIn (newCommand); if (newCommand.indexOf ("TURN ON") > 0) { digitalWrite (2, HIGH); if(newCommand.indexOf ("TURN_OFF") > 0) { digitalWite (2, LOW); }
Catégories
En savoir plus sur Signal Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!