
Driving an RGB LED — SIK Circuit 3
ہدایات
Parts & Introduction
Parts & Introduction
An RGB LED contains three tiny LEDs (red, green, blue) in one package. By mixing different brightness levels of each color, you can create any color in the rainbow. This experiment introduces analogWrite() for PWM output.
Parts Needed
- 1x Arduino Uno + USB cable
- 1x Breadboard
- 1x RGB LED (Common Cathode)
- 3x 330Ω Resistors
- 5x Jumper Wires
RGB LED Pin Order (flat edge facing you): Red, Ground (longest pin), Green, Blue.
اس مرحلے کے لیے مواد:
SparkFun Inventors Kit - V3.21 kit
Arduino Uno R31 piece
Breadboard1 piece
RGB LED (Common Cathode)1 piece
330 Ohm Resistor3 pieces
Jumper Wires5 piecesدرکار اوزار:
Hardware Hookup
Hardware Hookup
Wiring Instructions
- Place the RGB LED in the breadboard. Identify pins from the flattened edge: Red, GND (longest), Green, Blue.
- Connect the GND pin (longest, second from left) to the GND rail.
- Connect the Red pin through a 330Ω resistor to Arduino Pin 9.
- Connect the Green pin through a 330Ω resistor to Arduino Pin 10.
- Connect the Blue pin through a 330Ω resistor to Arduino Pin 11.
Pins 9, 10, and 11 are all PWM-capable (marked with ~ on the board).
اس مرحلے کے لیے مواد:
RGB LED (Common Cathode)1 piece
330 Ohm Resistor3 pieces
Breadboard1 piece
Jumper Wires5 piecesArduino Code
Arduino Code
Open the Arduino IDE and upload the following sketch to your Arduino board.
اس مرحلے کے لیے مواد:
Arduino Uno R31 pieceدرکار اوزار:
Test & Experiment
Test & Experiment
What You Should See
The LED cycles through 8 solid colors (off, red, green, blue, yellow, cyan, purple, white) for 1 second each, then smoothly fades through the entire color spectrum.
Troubleshooting
- Incorrect colors: With four pins close together, it's easy to misplace one. Double-check each connection.
- Red too bright: The red diode is often brighter. Try a higher-value resistor on the red pin, or reduce in code:
analogWrite(RED_PIN, redIntensity/3).
Experiments to Try
- Add a potentiometer to control which color is displayed.
- Create your own color sequences — try a "sunrise" effect (dark red → orange → yellow → white).
مواد
6- $105.00
- 1 pieceپلیس ہولڈر
- 1 pieceپلیس ہولڈر
- پلیس ہولڈر
- $3.00
You can swap these in
Can't get one of the materials? Swap it for an equivalent — these work just as well.
- Instead of Arduino Uno R3, try:
Prototyping Shield for Arduino Uno (3-Pack)
Arduino Uno R3 Board
Arduino Uno - Instead of Resistor 330 Ohm 1/6 Watt PTH - 20 pack, try:
Resistor 10K Ohm 1/6th Watt PTH - 20 pack
AVR ISP Shield - PTH Kit
Resistor 1.0M Ohm 1/6th Watt PTH - 20 pack - Instead of Breadboard, try:
Solder-able Breadboard - Instead of LED - RGB Diffused Common Cathode - 5mm, try:
LED - RGB Clear Common Cathode - 5mm
Recommended for this build
Products makers often use with builds like this one.
5mm LED Assortment Kit (300pcs, 5 Colors)Used together and in similar builds
Resistor 10K Ohm 1/6th Watt PTH - 20 packFrequently used with this build's materials
Diode KitFrequently used with this build's materials
BC547 NPN Transistor (50-Pack)Frequently used with this build's materials
Push Button - 33mmFrequently used with this build's materials
Piezo ElementFrequently used with this build's materials
PotentiometerFrequently used with this build's materials
Servo MotorFrequently used with this build's materialsRelated blueprints
Other builds that share materials, tools, or techniques with this one.






CC0 پبلک ڈومین
یہ بلیو پرنٹ CC0 کے تحت جاری کیا گیا ہے۔ آپ اجازت لیے بغیر اس کام کو نقل، ترمیم، تقسیم اور کسی بھی مقصد کے لیے استعمال کرنے کے لیے آزاد ہیں۔
میکر کی حمایت کریں ان کے بلیو پرنٹ کے ذریعے پروڈکٹس خرید کر جہاں وہ میکر کمیشن وینڈرز کی طرف سے مقرر، کماتے ہیں، یا اس بلیو پرنٹ کی نئی تکرار بنائیں اور آمدنی شیئر کرنے کے لیے اسے اپنے بلیو پرنٹ میں کنکشن کے طور پر شامل کریں۔