![]() PreviousMillis2 = currentMillis // Remember the timeĭigitalWrite(ledPin2, ledState2) // Update the actual LEDĮlse if ((ledState2 = LOW) & (currentMillis - previousMillis2 >= OffTime2)) If((ledState2 = HIGH) & (currentMillis - previousMillis2 >= OnTime2)) PreviousMillis1 = currentMillis // Remember the timeĭigitalWrite(ledPin1, ledState1) // Update the actual LEDĮlse if ((ledState1 = LOW) & (currentMillis - previousMillis1 >= OffTime1)) ![]() If((ledState1 = HIGH) & (currentMillis - previousMillis1 >= OnTime1)) check to see if it's time to change the state of the LED Long OffTime2 = 400 // milliseconds of off-time Long OnTime2 = 330 // milliseconds of on-time Unsigned long previousMillis2 = 0 // will store last time LED was updated Int ledState2 = LOW // ledState used to set the LED Int ledPin2 = 7 // the number of the LED pin Long OffTime1 = 750 // milliseconds of off-time Long OnTime1 = 250 // milliseconds of on-time Unsigned long previousMillis1 = 0 // will store last time LED was updated Int ledState1 = LOW // ledState used to set the LED Int ledPin1 = 4 // the number of the LED pin ![]() ![]() These variables store the flash pattern Right now I'm working off the "millis() for timing" tutorial which, as I said, old allows a single on and off time to be set (I need a no delay solution because I'll be having other LEDs fading and blinking independently). 33 of a second, and the go off the remaining. At the same time a second set of LEDS should be off at the start for 1.33 seconds, flash for. What I what is a set of LEDs to turn on for a second, then off for a second. At the moment every tutorial I've found has had a single on/off state. I have a couple of LEDs that I'd like to turn off and on in a sequence, but I'm having trouble finding out how to have multiple on/off states for each. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |