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 17: Control Multiple LED from the Serial Monitor
This lesson demonstrates how to create a user-controlled LED system using the Arduino, where the user can turn on and off different LEDs based on input through the serial monitor. Here’s a brief overview of what you will learn:
Reviewing Previous Homework:Recapping the assignment from Lesson 16, which involved making a circuit with three LEDs (red, yellow, and green) and controlling them based on user input.
Setting Up the Circuit:Detailed instructions on how to correctly connect three LEDs and their current-limiting resistors to the Arduino. Each LED’s long leg (anode) is connected to a digital pin, and the short leg (cathode) is connected to ground through a resistor.
Writing the Code:Step-by-step coding instructions to:Define the pins for each LED,Set up the serial monitor for user input,Use if statements to turn on the specified LED and ensure all other LEDs are turned off,Convert user input to lowercase to handle different cases.
Debugging Tips:Guidance on troubleshooting common issues such as missing semicolons, incorrect curly braces, and ensuring all LEDs are correctly turned off when a new LED is turned on.
Practical Applications:Examples of using if statements to handle user input and control multiple outputs (LEDs) based on that input.
Homework Assignment: Extending the project by asking the user for both the LED color and the desired brightness.
Video