0% found this document useful (0 votes)
62 views13 pages

2 - RGB Led PDF

This document introduces RGB LEDs and digital inputs. It explains that an RGB LED contains individual red, green, and blue LEDs that can be controlled to produce different colors. Pulse width modulation is used to vary the brightness of each LED. The goal of the practical exercise is to use for loops to transition the RGB LED from red to green to blue to red. Digital push switches are also introduced, which connect contacts when pressed, allowing electricity to flow. Their schematic and wiring are depicted. The document is presented by Marcelo Fajardo-Pruna from ESPOL for an introduction to mechatronics course.

Uploaded by

Edgar Narvaez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views13 pages

2 - RGB Led PDF

This document introduces RGB LEDs and digital inputs. It explains that an RGB LED contains individual red, green, and blue LEDs that can be controlled to produce different colors. Pulse width modulation is used to vary the brightness of each LED. The goal of the practical exercise is to use for loops to transition the RGB LED from red to green to blue to red. Digital push switches are also introduced, which connect contacts when pressed, allowing electricity to flow. Their schematic and wiring are depicted. The document is presented by Marcelo Fajardo-Pruna from ESPOL for an introduction to mechatronics course.

Uploaded by

Edgar Narvaez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Introducción a la Mecatrónica

LED RGB and Digital Inputs


MCTG1018

Marcelo Fajardo-Pruna, PhD


[email protected]
ORCID ID: 0000-0002-5348-4032
SCOPUS ID: 57195539927
RGB LED

• Component Required:
• (1) x Elegoo Uno R3

• (1) x 830 Tie Points Breadboard

• (4) x M-M wires (Male to Male jumper wires)

• (1) x RGB LED

• (3) x 220 ohm resistors


Component Introduction

• RGB (Red, Green and Blue) LEDs look just like regular LEDs
• There are actually three LEDs, one red, one green and yes, one
blue.
• Controlling the brightness of each of the individual LEDs you can
mix pretty much any color you want.
• Anode goes to “+”
• Cathode goes to “-”
• Each LED inside the package requires its own 220Ω resistor to prevent too much
current flowing through it.
Resistor color code
Theory (PWM)

• Pulse Width Modulation (PWM) is a technique for controlling


power.
• So 'analogWrite(0)' will not produce any pulse at all and
'analogWrite(255)' will produce a pulse that lasts all the way until
the next pulse is due, so that the output is actually on all the time.

• PRACTICAL EXERCISE

• The goal is to use FOR loop to make the following transitions:


• The first FOR loop will go from RED to GREEN.
• The second FOR loop will go from GREEN to BLUE.
• The last FOR loop will go from BLUE to RED.
Schematic
Wiring diagram
Digital Inputs

• PUSH SWITCHES:
• Switches are really simple components. When you press a button
or flip a lever, they connect two contacts together so that electricity
can flow through them.
• The little tactile switches that are used in this lesson have four
connections, which can be a little confusing.
Schematic
Wiring diagram
Introducción a la Mecatrónica
LED RGB and Digital Inputs
MCTG1018

You might also like