Code Structure Advice

It is thank you.

My code is working fine when I call or they turns on or off. Also when I call returns the the temperature for each ds18b20 on that pin via serial which I read and process in node red, what do you mean it will only work on single digit pins.

My plan was to hard code any pins so once I start wiring I can use any digital pin for either temperature or relay control.

I had it working hard coded and the code was so repetitive it was bothering my and I thought I could improve it. Each temperature pin will have 3x ds18b20 these will be in zone and I will average these out incase one is a little out it should stabilise my readings. Then I will turn a relay on with a heater connected. This is a fish room control system.

My worry about the code was that creating DallasTemperature objects on the fly and then possibly using the same pin later as a relay pin code cause some memory issues. I will look at your code and try to understand your improvements after work.

Thank you