Reads the current position of the potentiometer and converts Int potBlue = A2 // Potentiometer controls Blue pin -> A2 Int potGreen = A1 // Potentiometer controls Green pin -> A1 Int potRed = A0 // Potentiometer controls Red pin -> A0 Upload the following sketch to your Arduino board: /* Important: if you’re using an common cathode RGB LED, you need to connect the longer lead to GND instead of 5V. You can use the preceding links or go directly to /tools to find all the parts for your projects at the best price!įollow the next schematic diagram to wire the circuit: RGB LED common anode or RGB LED common cathode.Arduino UNO – read Best Arduino Starter Kits. Note: we’ll be using a common anode LED for this project, but if you already have a common cathode LED it’s fine to use that just watch out for the differences noted in the circuit wiring and code. The project we’ll build uses three potentiometers to control the light intensity of each pin (LED) of the RGB LED to produce any color you want.įor this example you need the following parts: In this example, we show you how to control the color of an RGB LED using an Arduino.
0 Comments
Leave a Reply. |