Didactronica
Hello.
 
I am using the example MQTT_send_receive modificated to control a GPIO as output, but with an Esp32. ( https://www.youtube.com/watch?v=pTC2SyiJaLM)
 
This is the suscription:
[203128%2F8897511%2Fmceclip0]
 
[203128%2F8897513%2Fmceclip0]
 
The problem occurs if the build version of the Esp32 development kit is used. The varaible with the suscription is automatically reset every few seconds.
 
With the Esp32 version, the variable don´t reset, but,  set and reset coils only work for a moment. 
 
[203128%2F8897515%2Fmceclip0]
 
Howevere, SR function, works fine:
 
[203128%2F8897566%2Fmceclip0]
 
I have the editor updated.

Greetings and thank you.
Reply 0 0
thiagoralves
msg_received only contains your message for a single cycle when you receive it. The next cycle it goes back to empty. I suggest you send and compare what you receive with a valid string (like 'salidaGPIO_on' or 'salidaGPIO_off') instead of just blindly converting the string to int.
Reply 0 0
Didactronica
Ok, it works fine!!
Reply 0 0
NutTecho
msg_received only contains your message for a single cycle when you receive it. The next cycle it goes back to empty. I suggest you send and compare what you receive with a valid string (like 'salidaGPIO_on' or 'salidaGPIO_off') instead of just blindly converting the string to int.
How do i move msg_received to other variables to avoid missing data and store value for comparison. About comparison block , their have no trigger enable input so that will always compare every cycle. How to fix this?
Reply 0 0
thiagoralves
Use the RECEIVED output pin of the MQTT_RECEIVE block to trigger a MOVE of your received string to another variable of your choice.
Reply 0 0
NutTecho
Use the RECEIVED output pin of the MQTT_RECEIVE block to trigger a MOVE of your received string to another variable of your choice.
[203128%2F8926484%2Fmceclip0]
 
This is my solution. I will create new function block with enable on and use mqtt_received to trig and compare that protect to compare with null value on next cycle.
Reply 0 0
thiagoralves
Something as simple as this should work to retain your received message:
 
Screenshot 2024-08-06 at 9.44.43 AM.png
Reply 0 0
NutTecho
Something as simple as this should work to retain your received message:
 
Screenshot 2024-08-06 at 9.44.43 AM.png
Oh!! I just founf out MOVE function block can set enable. Thanks for recommend.
Reply 0 0
Reply