Hello,
I am attempting to control a motor via a SSR and a switch.
I would like to have the motor come on for 20 seconds then off for 30 minutes and repeat that pattern as long as the switch is on.
Here is my code so far, keep in mind that this is my first program and I am learning from google searches... Would this accomplish what I am trying to do?
int motor = A2;
int inPin1 = 3;
double p = 0; //delay parameter
double longDelayInSeconds = 0; //long delay parameter
void setup() {
Serial.begin(9600);
pinMode(A2, OUTPUT); //SSR Coil
pinMode(3, INPUT); // set the pin to input
}
void loop() {
if (inPin1 == LOW); {
}
if (inPin1 == HIGH);
{digitalWrite(motor, HIGH);
delay(20000); // run for 20 seconds
digitalWrite(motor, LOW);
longDelayInSeconds = 1800; //30 minutes
while (p < longDelayInSeconds) {
delay(1000);}