Hi all,
I’ve been trying to control RGB lighting with an Arduino Nano RP2040. I use pin D8, D9 and D10 to control the RGB components using PWM.
Please find below a picture of a basic setup that reproes the issues as well as matching code.
Here are the results of the experiment:
(1) When setting D8 to 255 using analogWrite, the red LED turns on, as expected.
(2) When setting D9 to 255 using analogWrite, both the green and blue LEDs turns on, when only the green should turn on.
(3) When setting D10 to 255 using analogWrite, both the green and blue LEDs turns on, when only the blue should turn on.
Here are additional experiments:
(A) When swapping the Arduino Nano RP2040 with another RP2040 sourced from a different supplier (to eliminate manufacturing issues), in the very same setup, the issues still repro.
(B) When swapping the Arduino Nano RP2040 with an Arduino Nano (plain, not RP2040), in the very same setup, the issue does not repro, the individual RGB components turn on/off as expected.
(C) This also reproes whether I include “WiFiNINA.H” or not at the top.
Thanks in advance for any help or leads,
arduousno
Setup picture:
Code:
#include <WiFiNINA.h>
#include <Arduino.h>
#define REDPIN 8
#define GREENPIN 9
#define BLUEPIN 10
void setup() {
Serial.begin(9600);
pinMode(REDPIN, OUTPUT);
pinMode(GREENPIN, OUTPUT);
pinMode(BLUEPIN, OUTPUT);
}
int iteration = 0;
void loop() {
switch (iteration % 4)
{
case 0:
analogWrite(REDPIN, 255);
break;
case 1:
analogWrite(GREENPIN, 255);
break;
case 2:
analogWrite(BLUEPIN, 255);
break;
case 3:
analogWrite(REDPIN, 255);
analogWrite(GREENPIN, 255);
analogWrite(BLUEPIN, 255);
break;
}
++iteration;
delay(2000);
analogWrite(REDPIN, 0);
analogWrite(GREENPIN, 0);
analogWrite(BLUEPIN, 0);
delay(500);
}