Skip to content

limingjie/M5Stack_Traffic_Light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

M5Stack Traffic Light

A traffic light toy build by M5Stack.

M5Stack Traffic Light Video

Build

  • Setup Arduino development environment follow M5Stack Docs - Arduino IDE Development.
  • Install Adafruit NeoPixel library, supports up to 1.2.5, it does not work with 1.3.0 or above. There was a bug of the m5stack's light strip control, I will try the latest version of m5stack library when I have time.

Customize The Traffic Light

Find the traffic light sequence definition in TrafficLight.ino. Customize the sequence in lights array.

// Traffic light struct
typedef struct
{
    int color_index; // 1 - Red, 2 - Yellow, 3 - Green
    bool turn_left;
    bool blink;
    unsigned long interval; // milliseconds
} Traffic_Light;

// Traffic light sequences
Traffic_Light lights[] = {
    {3, false, false, 30999},
    {3, true, true, 30999},
    {2, true, true, 10999},
    {1, false, false, 30999},
    {1, false, true, 10999}};