RGB LED nRF52

dev board Adafruit Feather Bluefruit
chip nRF52
features RGB LED

Before starting

Dependancies

Ensure the following requirements are available:

Pre-requisites

Try these simpler examples:

Buy the components

Description

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

Code

Download code
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

References