Arduino: a revamped tiny Sketch

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!

RGB LED board

I knew what I wanted to do with it. 

Adjust RGB

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:

Turquoise Green LED

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:

  1. R -> 9
  2. G -> 10
  3. B -> 11
  4. (-) -> GND

Connect three wires from the potentiometer to your board:

  1. to ground from one of the outer pins of the potentiometer
  2. to 5 volts from the other outer pin of the potentiometer
  3. to analog input 0 from the middle pin of the potentiometer

You’re good to go …

What about the code?

I have also put it on a GitHub repo. Find it inside the ‘AdjustRGB‘ folder. Feel free to fork and improve it!

Powering it from batteries

That’s it for now. Hope you find it useful …