Light Disc with 7 SMD RGB LED Connected to an Arduino Pi Pico
![userHead](https://dfimg.dfrobot.com/dfPortrait2.png)
Try to do something very simple but struggling.
Just trying to do testing with a Light Disc with 7 SMD RGB LED Connected to an Arduino Pi Pico.
Using the following code. I have included a photo of our setup. The code goes on but we aren't getting any lights.
Any help would be much appreciated.
int B = 3; //Connect Blue led to Digital pin 3
int R = 5;//Connect Red led to Digital pin 5
int G = 6;//Connect Green led to Digital pin 6
//Connect the 5V pin of light disc to GND Pin of Arduino
void setup()
{
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
}
void loop()
{
digitalWrite(B,random(255));
digitalWrite(R,random(255));
digitalWrite(G,random(255));
delay(80);
}
![](https://dfimg.dfrobot.com/64b750d5aa9508d63a42fbaa/makelog/f6e792feacf0f0d2102261eff70740d4.jpg)
Thanks for your reply. LED lights power up fine when installing code (i think they're meant to flash to acknowledge this has happened). So I don't think it's a power supply issue.
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)
Hi!
1.
I checked the information on Arduino Pico. Please try the analogWrite() function, it might work.
https://arduino-pico.readthedocs.io/en/latest/digital.html
![](https://dfimg.dfrobot.com/nobody/makelog/c7f07da7032ec77fdd796465a8fa3a76.png)
This is the document of random(). The random function generates pseudo-random numbers.
https://www.arduino.cc/reference/en/language/functions/random-numbers/random/
The ADC bit of RP2040 is 12bit and the range of ADC is 4096.
pls try this code.
int B = 3;
int R = 5;
int G = 6;
void setup() {
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT); }
void loop() {
analogWrite(B,4096);
analogWrite(R,4096);
analogWrite(G,4096);
delay(80); }
2. I checked the information on Arduino Pico and found that its pin current is relatively small. Compared with the current specification of the 7 SMD RGB LED, this may cause the LED not to be driven.
![](https://dfimg.dfrobot.com/nobody/makelog/547f9f70101010a217cf3a0eae8ba68a.png)
![](https://dfimg.dfrobot.com/nobody/makelog/3c4dc32c6934d13819352df56773fa59.png)
Hi!
LED Power Supply: 5V
But the pico can only provide 3.3V, maybe the voltage is insufficient.
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)