Hi.
Posted a lot on your first day (haven't seen the other posts yet).
But still, slow down.
Let me ask you first to read this (click !).
It is on top in every part of the forum, and tells you how to use it.
Don't think you know all that, just read it once or twice and use the information.
So next time you post some code, put it in code tags like this:[code] put it here [/code]
.
Your code can't be right.
You are trying to work with something that constantly changes (time), but you are assigning constants to it, even though you do not define them as such.
void setup() {
// initialize outputs:
pinMode(ledPin9, OUTPUT);
strobetimer = millis ();
strobetime1=millis(); // set time as now
strobetime2=millis()+30; //first strobe duration
strobetime3=millis()+100; // short wait
strobetime4=millis()+150; //second strobe duration
strobetime5 = 1000; //long wait
}
This is effectively assigning constants.
Setup is only run once.
Read millis() as "now".
Then you set strobetime1 to now, exaclty like you described.
And strobetime2 to now (a fraction later than the now in strobetime1) + 30 milliseconds
And so on.
Then you are checking to see some things are true, but at least after the first iteration they are always true.
void strobeflash () {
{
// Strobe Sequence :
// strobetime1=millis(); // set time as now
if(millis()>strobetime1) // first strobe flash
digitalWrite(ledPin9, HIGH); // set the LED on
if(millis()>strobetime2) // short wait
digitalWrite(ledPin9, LOW); // set the LED off
if(millis()>strobetime3) // second strobe flash
digitalWrite(ledPin9, HIGH); // set the LED on
if(millis()>strobetime4) // end of second flash
digitalWrite(ledPin9, LOW); // set the LED off
}
}
The short wait might be an actual wait only the first iteration, after that millis will for sure always be > strobetime2
So your sketch can't do what you expect it to do.
What you might want to do, is this:
strobetime1=millis(); // set time as now
const long strobetime2=30; //first strobe duration
const long strobetime3=100; // short wait
const long strobetime4=150; //second strobe duration
const long strobetime5 = 1000; //long wait
And then check to see what timers have elapsed by comparing them to a variable that was set by millis() when strobeinterval lapsed.
Because you are comparing to a long (millis()), you should use a long here too.
Study blink without delay some more.