Hi
Ive got two 12v Led Lights hooked up to my arduino mega through a pair of N channel MOSFETS.
I am trying to make one light flash 3 times in 75 millisecond pulses then repeat on the other light.
It all works fine, I want to remove the delay so i can use it on my robot without it pausing the code with delays.
Ive looked at the blink without delay sketch (http://arduino.cc/en/Tutorial/BlinkWithoutDelay) but I'm not sure how to integrate it into my code.
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
int del;
void setup() {
// initialize the digital pin as an output.
// Pin 34 and 35 has an LED connected:
pinMode(34, OUTPUT);
pinMode(35, OUTPUT);
}
void loop() {
del = 75;
left();
off();
left();
off();
left();
off();
right();
off();
right();
off();
right();
off();
}
void left(){
digitalWrite(34, HIGH); // set the first LED on
digitalWrite(35, LOW); // set the second LED off
delay(del); // wait for a 75 milliseconds
}
void right(){
digitalWrite(34, LOW); // set the first LED off
digitalWrite(35, HIGH); // set the second LED on
delay(del); // wait for a 75 milliseconds
}
void off(){
digitalWrite(34, LOW); // set the first LED off
digitalWrite(35, LOW); // set the second LED off
delay(del); // wait for a 75 milliseconds
}
If someone could give me some help it would be muchly appreciated.
Cheers, Alex ![]()