I have an issue with closing connections to UBIDOTS. I know that if the message “No socket available” is given through the serial, that somewhere in my code, I’m not closing my connection properly. Problem is, that I have tried the client.stop() and flush() command everywhere but cant seem to fix this is issue. I am able to successfully send data for about 3 hours before this issue starts.
Can anyone please have a look at my code and see where I’m going wrong.
Project in a nutshell: 2 HC-SR04 sensors pick up distance in a oil tank, does a quick calculation to determine oil quantity. This is then sent to UBIDOTS. At the moment everything is working 100% until the socket run out. (Usually 3 hours)
WorkingTemplate3.ino (6.25 KB)