I have a question - what I'd like to do is trigger a relay and LED's based on a timer count (int timer) [see below]
the complicated part for me is I need the relay to be on and off for different times - like blink an LED on and off but "on" longer than "off", let's say for example at timer = 60 seconds , LED will blink long, off short, on long, then LED = false; wait for next time.
I've tried using an array to contain the times and then trigger a function, I couldn't get it to work without bugs, so if I can have an array[] = { 1, 10, 20, 30, 60}; and at those times blink an LED, I've found myself at a roadblock and though I've found good examples and learned cool stuff like how to use poynters, I haven't figured this out - driving me crazy.
I couldn't seem to get this to work, I'm sure there's got to be a better way:
for( i = 0, i <= sizeof(array[]), i++){
If ( timer == array[i]){ //run LED sequence here;
}
I'm always looking to improve my programming so all advice is greatly appreciated
void loop() {
// Main start
if (digitalRead(start3BTN) == HIGH){
start = true;
}
if (start == true){
sequence = true;
start = false;
timer = 0;
}
if (sequence == true){
while (timer < 180)
{
ms = millis();
if(ms - prevms >= oneSEC ){
prevms = ms;
timer++;
Serial.println(timer); // for checking time on serial monitor
}
if (timer == 1){
longON();
}