In this experiment, we will learn how to change RGB led colour with push button.

Hardware Required

  • Arduino or Genuino Board
  • Push Button
  • RGB led
  • Jumper wires
  • breadboard

MIN REQUIRED:20

Connection:

 

Procedure

  1. Take the Breadboard.
  2. Connect the RGB led onto the breadboard and the push button onto the breadboard.
  3. Connect the pin for the red colour to the Digital pin 11 on the Arduino.
  4. Connect the pin for the green colour to the Digital pin 10 on the Arduino.
  5. Connect the pin for the blue colour to the Digital pin 9 on the Arduino.
  6. Now connect the +5V and GND to the horizontal side as +5V to plus sign (+) and GND to the negative sign (-) on the breadboard.
  7. Fix the push button on the breadboard as shown in the above image for connection of the push button to the breadboard
  8. Connect the one pin of the push button to digital pin 3 on Arduino and other pin to the GND on the breadboard.
  9. Connect Arduino to your Laptop/PC by USB Cable. ( we use A to B USB cable for Arduino which is also used in printers )
  10. Open Arduino IDE ( You can download it from here or you can use online platform Arduino Web editor )
  11. Type the code Below given.
  12. Check program and then upload it
LINES OF CODE