how to trigger relay for 10 sec and then switch off for 10 mins without time module
What have you tried so far?
@rahul6047, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project See About the Installation & Troubleshooting category.
Arduinos have a built-in 'timer'; it's called millis(). millis() - Arduino Reference
Have a look at the "Blink without delay" sketch in the Arduino IDE Examples.
That sketch has the same on time and off time, but could be modified for your requirements
Is that all you want to do? What happens after 10 minutes? Does the relay turn back on?
Such code could be as simple as:
const uint8_t pinRelay = 2;
void setup()
{
pinMode( pinRelay, OUTPUT );
}//setup
void loop()
{
digitalWrite( pinRelay, HIGH ); //turn the relay on
delay(10000ul); //wait 10-seconds
digitalWrite( pinRelay, LOW ); //turn the relay off
delay(600000ul); //wait 10 minutes (10 min x 60-sec/min x 1000mS/sec)
}//loop
If you want to do more tasks in between switching the relay on and off you'll need to use, say, the
millis() function to allow you to not use blocking functions like delay().
Thanks alot...
Thank u sir
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.