4095 Constat value from sensor after integrating MQTT

When i am reading value from soil moisture sensor it works fine but when i connect it with MQTT it gives me constant 4095 value from sensor .

  1. I have tried to publish constant value it works fine.
  2. I have tried to publish value of RTC for troubleshooting. It gives me 4095.0021, 21 as time.
  3. Tried connecting Vcc to 3.3 and 5v still output remains same.

I have used ESP32 development board.
Please go through this and let me know where i am wrong.
MQTT_Publisher1.ino (3.1 KB)

Hi @Meet

We generally solve Ubidots related problems, but your case got my attention, seems like you are having an electronics issue, I assume you are using the resistive probe, just had a look at your code and it seems fine, if you have the opportunity share with us the diagram in the post and maybe we can give you a slightly better answer.