Arduino Mega send data to ESP8266-01 then ESP forward to RPI (MQTT)

I used delay because I thought it would slow down the data coming to the terminal on the Pi and it wouldn't be so clustered, basically display smoother.

The blink without delay example shows how to do that without using delay().

Even better, though, would be to publish() only when the temperature or humidity changes.