TalkBack string newCommand?
2 views (last 30 days)
Show older comments
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.");
}
0 Comments
Answers (1)
ASSET
on 28 May 2023
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); }
0 Comments
See Also
Categories
Find more on Act on Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!