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!

IMG_20151227_085209
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:

IMG_20151227_090442
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!

IMG_20151226_130208409

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

IMG_20151226_130157617

You’re good to go …

What about the code? Since I didn’t want to take up much space here, I put it on a GitHub repo. Find it inside the ‘AdjustRGB‘ folder.

IMG_20151226_125136620
Powering it from batteries

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

Advertisements