Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: Cha_L on Aug 27, 2019, 09:51 pm

Title: ChangeLights function doesn`t work on my Arduino IDE
Post by: Cha_L on Aug 27, 2019, 09:51 pm
Hey everyone !
I am new to the Arduino projects and enjoying it !

I wanted to make the traffic light tutorial (found here (https://www.makeuseof.com/tag/arduino-traffic-light-controller/) ) the problem is the 'changeLights' function doesn't work, I mean it is not included in any Libraries on my arduino IDE... It's juste like the function won't work.
I've been looking on internet for the same situation than me but I couldn't find any help, or anyone that have the same issue so I know I definitely did something wrong but I don't know what....

Thanks in advance for your help !
Cha
Title: Re: ChangeLights function doesn`t work on my Arduino IDE
Post by: UKHeliBob on Aug 27, 2019, 11:57 pm
Quote
the problem is the 'changeLights' function doesn't work, I mean it is not included in any Libraries on my arduino IDE... It's juste like the function won't work.
Do you mean this changeLights() function which is on the page you linked to
Code: [Select]

void changeLights(){
    // green off, yellow on for 3 seconds
    digitalWrite(green, LOW);
    digitalWrite(yellow, HIGH);
    delay(3000);

    // turn off yellow, then turn red on for 5 seconds
    digitalWrite(yellow, LOW);
    digitalWrite(red, HIGH);
    delay(5000);

    // red and yellow on for 2 seconds (red is already on though)
    digitalWrite(yellow, HIGH);
    delay(2000);

    // turn off red and yellow, then turn on green
    digitalWrite(yellow, LOW);
    digitalWrite(red, LOW);
    digitalWrite(green, HIGH);
    delay(3000);
}

What happens when you run the program ?