With Schematic
Curt Lewellyn and 3 OthersGeraldo MoranSeungwoo Byun
Anxuan Xie
+5V
|
Photoresistor
|
+---- A0 (Analog Pin on Arduino)
|
Resistor (e.g., 10k ohms)
|
+---- GND
+5V
|
RGB LED (Common Anode)
|
+---- Red Pin ---- 9 (PWM Pin on Arduino)
|
+---- Green Pin ---- 10 (PWM Pin on Arduino)
|
+---- Blue Pin ---- 11 (PWM Pin on Arduino)
|
Resistor (e.g., 330 ohms)
|
+---- GND
Make sure to connect the components as described in the schematic:
Connect the photoresistor to an analog pin (e.g., A0) on the Arduino, along with a resistor (e.g., 10k ohms) connecting to the ground (GND) pin.
Connect the common anode of the RGB LED to +5V.
Connect each color pin of the RGB LED (Red, Green, Blue) to their respective PWM pins on the Arduino (e.g., 9, 10, 11).
Connect a resistor (e.g., 330 ohms) from each color pin to the ground (GND) of the Arduino.
This schematic assumes a common anode RGB LED. If you have a common cathode RGB LED, you'll need to adjust the connections accordingly.