Looping relay for specific on off time.

I am working on a concept where I need to use a 120VAC heater to warm up a space. What I would like to accomplish is having the heater only stay on for a certain amount of time per cycle i.e. 3 minutes. I also only what the heater to run only when the temperature drops below a certain threshold i.e. 60*F. I can get the heater to turn on and off when the temperature gets to low, but I can't figure out how to get it to only stay on for a set duration. Ideally every time it loops back through the program it will kick the heater back on if needed. Any guidance would be greatly appreciated.

I'm running on a SunFounder Mega 2560 and using SainSmart 16-Channel Relay Module for controlling power to my heater.

Some millis() timing tutorials:
Several things at a time.
Beginner's guide to millis().
Blink without delay().

If this does not help, post your code, tell us what the code actually does and how that differs from what you want.

Read the how get the most out of this forum sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code in code tags.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.