//---------------------- SETUP ----------------------------------//
const int pin_red = 12;
const int pin_green = 11;
const int pin_blue = 10;
const int pin_hielo = 9;
const int pin_pink = 8;
const int pin_botton_1 = 5;
const int pin_botton_2 = 4;
const int pin_botton_3 = 3;
const int redTon = 200;
const int redToff = 300;
const int greenTon = 4000;
const int greenToff = 4000;
const int hieloTon = 3200;
const int hieloToff = 4800;
const int pinkTon = 200;
const int pinkToff = 200;
byte red = LOW;
byte green = LOW;
byte blue = LOW;
byte hielo = LOW;
byte pink = LOW;
byte boton_1 = LOW;
byte boton_2 = LOW;
byte boton_3 = LOW;
unsigned long time = 0;
unsigned long time_red = 0;
unsigned long time_green = 0;
unsigned long time_hielo = 0;
unsigned long time_pink = 0;
void setup() {
pinMode(pin_red, OUTPUT);
pinMode(pin_green, OUTPUT);
pinMode(pin_blue, OUTPUT);
pinMode(pin_hielo, OUTPUT);
pinMode(pin_pink, OUTPUT);
pinMode(pin_botton_1, INPUT_PULLUP);
pinMode(pin_botton_2, INPUT_PULLUP);
pinMode(pin_botton_3, INPUT_PULLUP);
}
//---------------------- LOOP ----------------------------------//
void loop() {
time = millis();
update_red();
// update_green();
// update_blue();
// update_hielo();
// update_pink();
write_leds();
}
void write_leds(){
digitalWrite(pin_red, red);
digitalWrite(pin_green, green);
digitalWrite(pin_blue, blue);
digitalWrite(pin_hielo, hielo);
digitalWrite(pin_pink, pink);
}
void update_red() {
if (red == LOW) {
if (time - time_red >= redToff) {
red = HIGH;
// time when this process is done:
time_red += redTon;
}
}
else {
if (time - time_red >= redTon) {
red = LOW;
// time when this process is done:
time_red += redToff;
}
}
}
void update_green(){
}
void update_blue(){
}
void update_hielo(){
}
void update_pink(){
}
// void readButton() {
// if (millis() - previousButtonMillis >= buttonInterval) {
// if (digitalRead(buttonPin) == LOW) {
// buttonLed_State = ! buttonLed_State; // this changes it to LOW if it was HIGH
// // and to HIGH if it was LOW
// // time when this process is done:
// previousButtonMillis += buttonInterval;
// }
// }
// }