Datasheet
As you change the color (or as other data becomes available) you should receive the data on the nRF52, and see it in
the Serial Monitor output:
Complete Code
The latest version of this code is always available on Github (https://adafru.it/vaN), and in the Examples folder of the
nRF52 BSP.
The code below is provided for convenience sake, but may be out of date! See the link above for the latest
code.
#include <bluefruit.h>
BLEUart bleuart;
// Function prototypes for packetparser.cpp
uint8_t readPacket (BLEUart *ble_uart, uint16_t timeout);
float parsefloat (uint8_t *buffer);
void printHex (const uint8_t * data, const uint32_t numBytes);
// Packet buffer
extern uint8_t packetbuffer[];
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Adafruit Bluefruit52 Controller App Example"));
Serial.println(F("-------------------------------------------"));
Bluefruit.begin();
Bluefruit.setName("Bluefruit52");
// Configure and start the BLE Uart service
bleuart.begin();
// Set up the advertising packet
setupAdv();
// Start advertising
Bluefruit.Advertising.start();
}
void setupAdv(void)
{
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
Bluefruit.Advertising.addTxPower();
// Include the BLE UART (AKA 'NUS') 128-bit UUID
Bluefruit.Advertising.addService(bleuart);
© Adafruit Industries https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide Page 39 of 175