ESP8266_ESP32_REST_API
-
Re: 0302-11_ESP8266_REST_API_example
Hi all,
I factually succeeded to use the ESP32 with a digital Temp. / RH sensor connecting to my Raspberry Pi.
However I'm wondering if I also would easily be able to get a kind of "Status" signal from the ESP32 (created in the Sketch) that is giving me feedback if there was a reply received, just like a "Modbus connected" signal.
If the ESP32 is no longer updating the various parameters because there is no communication anymore, it would become handy to be aware of it.I assume it would not take much programming in the sketch, but so far I'm not vary familiar with the arduino IDE programming of an ESP32 (or ESP8266).
Any feedback would be appreciated.
Regards,
Peter -
Hi Peter,
you can use the MP block for such a purpose. Set the MP:pwidth parameter to e.g. 5 seconds and set the MP:RPTF parameter to ON.From your ESP32, you'll periodically write ON to MP:BSTATE parameter (e.g. once per second) via REST API of REXYGEN. As long as the ESP32 keeps communicating, the output MP:Y will be ON. If there is no communication from ESP32 for more than 5 seconds, the MP:Y output will turn OFF.
In other words, the MP block acts as a communication watchdog in this case.
Hope it helps, let me know.
Kind regards,
Jaroslav