First of all I have a knock off chin board where High is off and LOW is on.
In the code below it starts with the LED on. I need to start with the LED off.
*/
// constants won't change. Used here to
// set pin numbers:
const int stro2Pin = 8; // the number of the LED pin
// Variables will change:
//int stro2Pin = low;
int stro2num = 1; // ledState used to set the LED
long prestro2Millis = 0; // will store last time LED was updated
long stro2interval1 = 860; // interval at which to blink on(milliseconds)
long stro2interval2 = 900; // interval at which to blink off(milliseconds)
long stro2interval3 = 940; // interval at which to blink on(milliseconds)
long stro2interval4 = 980; // interval at which to blink off(milliseconds)
long stro2interval5 = 1800; // interval at which to blink off(milliseconds)
//long stro2interval6 = 1800; // interval at which to blink off(milliseconds)
void setup() {
// set the digital pin as output:
pinMode(stro2Pin, OUTPUT);
}
void loop()
{
// check to see what strob count you are on to see what interval is needed
unsigned long curstro2Millis = millis(); // set time to now
if (stro2num == 1 && curstro2Millis - prestro2Millis > stro2interval1) {digitalWrite(stro2Pin, LOW); stro2num = 2;} // 1st flash off
if (stro2num == 2 && curstro2Millis - prestro2Millis > stro2interval2) {digitalWrite(stro2Pin, HIGH); stro2num = 3;} // 1st flash on
if (stro2num == 3 && curstro2Millis - prestro2Millis > stro2interval3) {digitalWrite(stro2Pin, LOW); stro2num = 4;} // 2nd flash off
if (stro2num == 4 && curstro2Millis - prestro2Millis > stro2interval4) {digitalWrite(stro2Pin, HIGH); stro2num = 5;} // 2nd flash on
if (stro2num == 5 && curstro2Millis - prestro2Millis > stro2interval5) {digitalWrite(stro2Pin, HIGH); stro2num = 1; // 2nd flash off
//if (stro2num == 6 && curstro2Millis - prestro2Millis > stro2interval6) {digitalWrite(stro2Pin, HIGH); stro2num = 1; // 2nd flash off
prestro2Millis = curstro2Millis; // set the time to start loop over
}
}