Testing the onboard square SMD RGB LED module

I found a code snippet on-line from sandeepmistry and created a simple sketch to see just how the SMD RGB LED module works. I thought it might be useful as an on-board visual status indicator in lieu of using the serial monitor. Has anyone else tried using it for anything? From what I understand, and I could be wrong, it would appear that the LED is not available if you enable BLE.

Here is the code:

// Include the library code
#include <WiFiNINA.h>
#include <utility/wifi_drv.h>

void setup() {
// Set LED pin modes to output
WiFiDrv::pinMode(25, OUTPUT);
WiFiDrv::pinMode(26, OUTPUT);
WiFiDrv::pinMode(27, OUTPUT);

// Set all LED color levels to zero for off, the max value is 128
WiFiDrv::analogWrite(25, 0); // RED
WiFiDrv::analogWrite(26, 0); // GREEN
WiFiDrv::analogWrite(27, 0); // BLUE
}

void loop() {
// Set Inital test values
int r = 32;
int g = 32;
int b = 32;

// Loop through each LED one at a time (Red, Green, Blue)
WiFiDrv::analogWrite(25, r);
delay(2000);
WiFiDrv::analogWrite(25, 0);

WiFiDrv::analogWrite(26, g);
delay(2000);
WiFiDrv::analogWrite(26, 0);

WiFiDrv::analogWrite(27, b);
delay(2000);
WiFiDrv::analogWrite(27, 0);
}

LED_ControlDemo.ino (821 Bytes)

Digging through the WiFiNINA library, I found a simpler solution. Very straightforward.

WiFi.setLEDs(0, 255, 0); // Attention: green, red, blue