The code below shows a 'if' statement which consist of 2 functions: running 2 motors and blinking an LED.
if (UGVSelect == 1 && UGVAction == 's')
{
motorL->run(FORWARD); // turn it on going forward
motorR->run(FORWARD);
delay(1000);
for (int i = 0; i < 10; i++)
{
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
delay(100);}
}
Now, my code is has 2 different hardware running on seperate timings, which means that the motors will run with a delay of 1000 first. Afterwhich, the LED will then blink in the for loop.
How do i programme both the motor and LED codes to be executed at the same time? i.e. i want the motors to run and at the same time, i want the LED to blink.