About Lesson
Smart Traffic Light
Introduction
In this project, you will make a traffic light model using RGB LED. You are going to use RGB(Red Green Blue) LED, Jumper wires, and Kblox Neo for making this project. After programming the board, the RGB LED will glow like a traffic light i.e. First Red Light will glow for few seconds, then Green Light will glow as soon as Red Light is turned off and then Yellow Light will glow after Green Light is turned OFF.
Components Required
- Kblox Neo
- RGB LED [Qty-1]]
- Jumper wires [M-M, Qty-4]
- A to B USB cable
Code
#include"kblox.h"
kblox kit;
void setup() {
kit.rgb_begin(5, 6, 7); //define led pins
}
void loop() {
kit.red(HIGH); //set led high
delay(10000);
kit.red(LOW); // set led low
kit.green(HIGH);
delay(7000);
kit.red(HIGH);
kit.green(HIGH);
delay(3000);
kit.red(LOW);
kit.green(LOW);
}
Applications
- LEDs can be connected in a sequence that forms a name or any letter.
- LEDs Can be used for recreational purpose
- A collection of LEDs can be programmed in such a way that forms some shape.