Hello, I am trying to use the builtin RGB led and ArduinoBLE library simultaneously. The following sketch blinks leds as expected:
#include <Arduino.h>
#include <WiFiNINA.h>
#include <ArduinoBLE.h>
void setup()
{
Serial.begin(9600);
while (!Serial && millis() < 5000)
{
//wait for USB serial to connect or 5 seconds to elapse
}
// define RGB led and builtin led
pinMode(LEDR, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(LEDG, OUTPUT);
pinMode(LEDB, OUTPUT);
//BLE.begin(); // uncomment this line and RGBs do not blink
}
void loop()
{
// blink the LEDs
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
digitalWrite(LEDR, HIGH);
delay(500);
digitalWrite(LEDR, LOW);
delay(1000);
digitalWrite(LEDG, HIGH);
delay(500);
digitalWrite(LEDG, LOW);
delay(1000);
digitalWrite(LEDB, HIGH);
delay(500);
digitalWrite(LEDB, LOW);
delay(1000);
}
But if you start the BLE (BLE.begin()) the RGBleds do not blink ! So there must be some incompatibility with BLE library, or is there anything I can do to preserve RGBs ?
I would like to use Nano RP2040 as BLE peripheral and use leds to indicate some status. The builtin led works normally.
I can confirm this seems to be a real issue. I noticed this a while ago but did not have time to investigate this further. I also tried this the other way around and BLE stops working if you do that.
The RGB LED is connected to the NINA module, and they require the WiFiNINA library. So, it seems plausible that RGB LED support with BLE was not tested.
Do you want to create an issue on GitHub, or would you like me to do that? I have an account. Then the Arduino developers can have a look it.
Done. I linked your post to the GitHub issue and will update you when I get any feedback from the Arduino team. You can have a look at the issue with the link below. This usually takes a few days.
"the issue is due to a limitation of BLE mode in the NINA.
In fact, we are configuring the esp32 to forward BLE via HCI, so we have no control over the protocol. RGB leds are controlled via SPI which is deactivated when BLE is active, hence the issue."