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?