Build a Traffic Light Project with Pico W and CircuitPython

Build a Traffic Light Project with Pico W and CircuitPython

Want to learn how to build a traffic light project using Pico W and CircuitPython? In this tutorial, we'll show you how to create a functional traffic light with just three LEDs and two buttons. You'll learn how to wire the LEDs and buttons, define their pins, and set their direction. We'll also cover how to define traffic light states, use a loop to check button states, and update the traffic light state accordingly. 

 

Video Tutorial

 

Components Required

 

Connection

 

Get Familiar with Thonny and CircuitPython

In this tutorial, we'll use Thonny editor to build the code for our traffic light project. If you're not familiar with Thonny, check out the video below to learn how to get started with it.

 

 

Code

 

Project complete

When the change button is pressed, the traffic light switches from displaying the red light to showing the green light. On the other hand, if the reset button is pressed, the yellow light is activated for a period of three seconds before the traffic light returns to displaying the red light.


Related Posts

Getting Started with Raspberry Pi Pico W and CircuitPython

Getting Started with Raspberry Pi Pico W and CircuitPython

If you're looking for a low-cost, high-performance microcontroller board that features built-in WiFi connectivity, the Raspberry Pi Pico W might be just what you need..


Chat hỗ trợ
Chat ngay