Edition 2 - Challenge 1 - The Color Selector

Challenge: Welcome to your 1st challenge! Help Leddy and Reggie make a color selector for their fireworks. Using a set of 3 buttons, control each color of the RGB LED independently. Use the first button for red, the second button for blue and the third button for green. When each button is pressed, turn the associated color on. When the same button is pressed again, turn that color off. On and Off like this is called "toggle" and you can use the .toggle method of your LED object in the code.

Place your components

Insert the three buttons on your breadboard, across the middle. Add a 100K resistor (brown-black-yellow-gold) for each button. Each resistor will have one of the lead connected to ground (GND).

Place your RGB LED somewhere on the breadboard, away from the buttons. Each color will need a 330 Ohms resistors (orange-orange-brown-gold). Leave the common cathode free

Place your wires

Next step, add all the wires needed for your components. You can choose your own colors, but try to keep them the same as the picture here to make it easier to debug your circuit in case of problems.

Analog Inputs: Connect each button/resistor to an analog input pin (A1, A2 and A3 as shown on the picture)

Digital Outputs: Connect each resistor from the LED to a digital output pin (D9, D10 and D11).

Power to the buttons: Connect each button to the power supply (+5V)

Your code

Use your editor to create your program. Use "nano" on Mac or "notepad" on PC. You can give your script (program) the name you want. Make sure to use the same name when you execute it with node.

The comments in the code (the parts in grey) are not necessary, but they will help you understand the code better. Having problem with this challenge? Let me know about it by filling this form.