Couple of days ago I wrote a post about how I got started with an Arduino UNO and wrote my first Sketch (a Sketch is an App written using Arduino IDE and and uploaded to the board via Serial). Click here to read it.
The Starter Kit had an LED attached to a a very small PCB with four pins. Picking it up I realized it was an RGB LED with three resistors printed on it. Neat!
I knew what I wanted to do with it.
This sketch is a follow up to my last one ‘AdjustBrightness.ino’ and allows you to pick what colour you want the LED to be! Like this colour (one of my favourites), for example:
What you need:
- Arduino or Genuino Board
- 10k ohm potentiometer
- RGB LED with resistors
- hook-up wires
- 4 male to female jumper wires
No need for a breadboard!
Connect the pins on the LED board to the Arduino:
- R -> 9
- G -> 10
- B -> 11
- (-) -> GND
Connect three wires from the potentiometer to your board:
- to ground from one of the outer pins of the potentiometer
- to 5 volts from the other outer pin of the potentiometer
- to analog input 0 from the middle pin of the potentiometer
You’re good to go …
What about the code?
That’s it for now. Hope you find it useful …