Borrar filtros
Borrar filtros

Thingspeak controlling a LED using ESP32 example

5 visualizaciones (últimos 30 días)
Risto Vesanto
Risto Vesanto el 27 de Sept. de 2021
Comentada: Risto Vesanto el 27 de Sept. de 2021
Hi the aplication works fine but the command TURN_ON does not pass to the if-sentense. I saw some ware else solution to this poblem adding a senstence index on the POST function? Unfortunately I have lost the it an dcan not any more locate it. If there are no commands in the que it returns 0 and the lenght is 5. Below is the print outs from serial monitor
First no commands in the que
16:23:25.180 -> checking queue...
16:23:25.180 -> Latest command from queue:
16:23:25.180 -> 0
16:23:25.180 ->
16:23:25.180 ->
16:23:25.180 -> command lenght = 5
Then with TURN_ON
16:26:16.684 -> Latest command from queue:
16:26:16.684 -> 7
16:26:16.684 -> TURN_ON
16:26:16.684 -> 0
16:26:16.684 ->
16:26:16.684 ->
16:26:16.684 -> command lenght = 17
The else sentence else{
Serial.println(" Nothing new.");
}
also does not react to no new commands.
Any help is needed!
  3 comentarios
Risto Vesanto
Risto Vesanto el 27 de Sept. de 2021
At the point when it prints 5 no new commands are in the Talkback que.
the code is
// Check the result
if(x == 200){
Serial.println("checking queue...");
// check for a command returned from TalkBack
if(newCommand.length() != 0){
int z = newCommand.length();
Serial.println(" Latest command from queue: ");
Serial.println(newCommand);
Serial.print("command lenght = ");
Serial.println(z);
and so on
Risto Vesanto
Risto Vesanto el 27 de Sept. de 2021
"if (newCommand.indexOf("TURN_ON")>0){
Serial.println("OPEN the door");
digitalWrite(LED_BUILTIN, HIGH);
}"
This works.
The author cstapels did have futher comments "... think the HTTP post function is the root of the error - and it didn't do this when we first wrote the code. Also it only seems to happen for ESP32, i tried on some other devices and did not get this effect.
My guess is that its in the wifi library. If you were to downgrade one version, my guess is that we would not have this problem.
The code above worked for us, we have recorded the problem and will plan to fix it in a future release. Let us know if that code works for you....."
I have not tested this code on ESP8266
Thanks for your answer best rgds Risto

Iniciar sesión para comentar.

Respuestas (0)

Comunidades de usuarios

Más respuestas en  ThingSpeak Community

Categorías

Más información sobre ThingSpeak en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by