Hey all, I am new to arduino as well as processing and I am trying to do something similar but with the blink w/out delay as the base code. How might I employ these same three pins 2,3,4 to work with blink without delay? Would I need to declare different intervals? or simply just copy the loop 2 more times and play with the interval? This is about as far as I am...
int ledPin2 = 2;
int ledPin3 = 3
int ledPin4 = 4// LED connected to digital pin 13
int value = LOW; // previous value of the LED
long previousMillis = 0; // will store last time LED was updated
long interval = 1000; // interval at which to blink (milliseconds)
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
// here is where you'd put code that needs to be running all the time.
// check to see if it's time to blink the LED; that is, is the difference
// between the current time and last time we blinked the LED bigger than
// the interval at which we want to blink the LED.
if (millis() - previousMillis > interval) {
previousMillis = millis(); // remember the last time we blinked the LED
// if the LED is off turn it on and vice-versa.
if (value == LOW)
value = HIGH;
else
value = LOW;
digitalWrite(ledPin2, value);
}
}
Thanks guys