Introduction: Disco Lights From RGB Using Arduino on TinkerCad
Once you have the RGB wired up, it is easy to control the colour of the RGB by using PWM output or analog output, for Arduino you can use analogWrite() on pins 3, 5, 6, 9, 10, 11, A0, A1, A2, A3, A4, A5 (for classic Arduinos using the Atmega328 or 168). An analogWrite(pin, 0) will turn that LED off, analogWrite(pin, 127) will turn it on half-way and analogWrite(pin, 255) will turn it on full blast. Here is some example code that performs a simple colour-swirl.
Step 1: Components Required:
1. Arduino UNO
2. RGB LED's * 7
3. Resistor *7 (220 ohms)
Step 2: Circuit Diagram:
In this project, I have used 7 RGB led which are commonly grounded. I have used all the available pins in the Arduino if you want to add more led then you can interface more RGB LEDs with Arduino mega.
If you have any doubt you can ask in the comment section.
Step 3: Code:
For credit, please follow my following accounts.
For more interesting projects connect with me on:
Facebook page: https://www.facebook.com/techeor1/
Participated in the
Arduino Contest 2020