Just started using UNO need help setting a time on running motor!! NOOB!!

define FLAME_DETECT_ANA A0 // Select the input pin for the flame detectors analogue output.

define FLAME_DETC_DIO 2 // Select the input pin for the flame detectors digital output.

int led = 8 ; // Select the input led pin for the relay motor

void setup() // Initialize serial and DIO {

Serial.begin(9600); // Setup the serial port for displaying the status of the sensor pinMode(led, OUTPUT);

pinMode(FLAME_DETC_DIO, INPUT); // Configure the DIO pin the sensors digital output will be connected to }

void loop() // Main program loop {

Serial.print("Sensor Value: "); // Read the sensors analogue output and send it to the serial port Serial.print(analogRead(FLAME_DETECT_ANA)); if (digitalRead(FLAME_DETC_DIO)) // Read the status of the sensors digital output and if it is high then send an alert to the UART and the led is lighten { Serial.println(" FLAME DETECTED!"); digitalWrite(led, HIGH); delay(1000); digitalWrite(led, LOW);

}else // Otherwise the there is no alert and the led is shut down { Serial.println(); digitalWrite(led, LOW); } }

So basically i have a AO DO flame detector that triggers an output pin 8 relay to turn on a bipolar motor. Only issue is when the flame detector reads high the motor runs and when the flame reads low the motor stops. My goal is once the flame detector reads high i need the motor to continue running for a specific time and then cutoff. Im new to this and just getting the first part of code done was daunting.

If you study the Blink Without Delay example sketch you will see how to use millis() to manage time.