RGB LED nRF52

Updated on 3 September 2021
dev board Adafruit Feather Bluefruit
chip nRF52
features RGB LED
This tutorial is more than 1 year old. If the steps below do not work, then please check the latest versions and the documentations of the individual tools used.

Before starting

Dependancies

Ensure the following dependancies are downloaded and available:

Pre-requisites

Try these simpler or similar examples:

Buy the components

Code

Download code rgb-led-nrf52.ino
int redPin = PIN_A1;
int greenPin = PIN_A2;
int bluePin = PIN_A3;

void setup() {
  analogWrite(redPin, 0);  // RED (purple)
  analogWrite(greenPin, 255);  // GREEN (yellow)
  analogWrite(bluePin, 0);  // BLUE (cyan)
}

void loop() { }

Makefile

.PHONY: lint compile upload clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

compile:
	arduino-cli compile --fqbn adafruit:nrf52:feather52832 ./

upload:
	adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ./.*.hex dfu-package.zip
	adafruit-nrfutil dfu serial --package dfu-package.zip -p /dev/tty.SLAB_USBtoUART -b 115200

clean:
	rm -f .*.bin
	rm -f .*.elf
	rm -f .*.hex
	rm -f *.zip

flash: lint compile upload clean

Schematic

Wire up the hardware accordingly

RGB LED nRF52 schematic

Description

Display colors with an RGB LED and Adafruit’s nRF52 Bluefruit board.

References