// Code from https://github.com/mudmin/AnotherMaker/tree/master/blink-without-delay
int red = 2;
int intervalRed = 1000; //how long to delay in millis
unsigned long previousRed = 0;
int redState = LOW;
int blue = 3;
int intervalBlue = 2500; //how long to delay in millis
unsigned long previousBlue = 0;
int blueState = LOW;
int green = 4;
int intervalGreen = 5000; //how long to delay in millis
unsigned long previousGreen = 0;
int greenState = LOW;
void setup() {
Serial.begin(9600);
pinMode(red, OUTPUT);
pinMode(blue, OUTPUT);
pinMode(green, OUTPUT);
}
void checkRed() {
unsigned long currentMillis = millis();
if (currentMillis - previousRed >= intervalRed) {
//save this reading!
previousRed = currentMillis;
//figure out if you should turn the LED on or off
if (redState == LOW) {
redState = HIGH;
} else {
redState = LOW;
}
digitalWrite(red, redState);
}
}
void checkGreen() {
unsigned long currentMillis = millis();
if (currentMillis - previousGreen >= intervalGreen) {
//save this reading!
previousGreen = currentMillis;
//figure out if you should turn the LED on or off
if (greenState == LOW) {
greenState = HIGH;
} else {
greenState = LOW;
}
digitalWrite(green, greenState);
}
}
void checkBlue() {
unsigned long currentMillis = millis();
if (currentMillis - previousBlue >= intervalBlue) {
//save this reading!
previousBlue = currentMillis;
//figure out if you should turn the LED on or off
if (blueState == LOW) {
blueState = HIGH;
} else {
blueState = LOW;
}
digitalWrite(blue, blueState);
}
}
void loop() {
checkRed();
checkGreen();
checkBlue();
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
r1:1
r1:2
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
r2:1
r2:2
r3:1
r3:2