Note

Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.

Why Join?

  • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.

  • Learn & Share: Exchange tips and tutorials to enhance your skills.

  • Exclusive Previews: Get early access to new product announcements and sneak peeks.

  • Special Discounts: Enjoy exclusive discounts on our newest products.

  • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.

👉 Ready to explore and create with us? Click [here] and join today!

Lesson 7: Controlling 3 LED with a Potentiometer in Micropython

This tutorial covers using a potentiometer to control three LEDs (green, yellow, and red) with the Raspberry Pi Pico W:

  • Homework Solution Review: Recap of connecting a potentiometer and three LEDs, mapping readings from 0 to 100.

  • Circuit Setup: Wiring diagram for connecting the potentiometer and LEDs to the Raspberry Pi Pico W.

  • Reading and Mapping Values: Reading analog values and mapping them from 432-65,535 to a 0-100 scale.

  • LED Control: Using if statements to control LEDs based on the potentiometer’s position (green for 0-79, yellow for 80-94, red for 95-100).

  • Practical Demonstration: Showcasing the circuit and code in action.

Video