Built-in RGB LED with BLE is not working

RGB LED with BLE fails no matter what program sequence I test. To reproduce the issue, turn on the LED and then start BLE which will turn the LED off.

#include <WiFiNINA.h>
#include <utility\wifi_drv.h>
#include <ArduinoBLE.h>

void setup() {

  const int ledPin = 27;  //R=26 G=25 B=27

  WiFiDrv::pinMode(ledPin, OUTPUT);

  WiFiDrv::digitalWrite(ledPin, HIGH);

  Serial.begin(115200);
  while (!Serial);

  if (!BLE.begin()) { // ble.begin trun the led off
    Serial.println("BLE Failed");
    while (1);
  }

  Serial.println("BLE started"); // last line shown on console
  
  WiFiDrv::digitalWrite(ledPin, HIGH); 

  // program never gets here

}


void loop() {}

The RGB LED is connected to NINA’s GPIO pins. Two of them (green and blue) are part of the UART, and another one is used for system control signals (red). I assumed that BLE.begin uses the UART to communicate with the processor and therefore avoided the red pin and added delays between commands hoping to separate the actions, but it didn’t work.

My goal is to use the RGB LED to indicate BLE states without adding three sets of MOSFETs and resistors. Ideas?

Which board and what pins? Post a link to it.

Gil, this is an MKRWIFI1010 on board RGB LED, as mentioned it's connected to NINA's GPIO (R=26 G=25 B=27).

For anyone with the same issue in the future, here's a comment from Arduino SE:

...You will not make it work. The nina-fw has two modes WiFi and BLE and the commands for the RGB LED are handled in the WiFi part of the firmware.
Juraj

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.