From 8c5c66ef17e520d4e6c987d23d2ec740ffc25a15 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 17 Feb 2020 13:52:29 +0700 Subject: [PATCH] temp work --- .../bluefruit_playground/bluefruit_playground.ino | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/bluefruit_playground/bluefruit_playground.ino b/libraries/Bluefruit52Lib/examples/Peripheral/bluefruit_playground/bluefruit_playground.ino index 2c63e164..843fe976 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/bluefruit_playground/bluefruit_playground.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/bluefruit_playground/bluefruit_playground.ino @@ -49,12 +49,14 @@ BLEAdafruitAddressablePixel blePixel; #elif defined ARDUINO_NRF52840_CLUE #include #include + #include #define DEVICE_NAME "CLUE" #define NEOPIXEL_COUNT 1 Adafruit_APDS9960 apds9960; Adafruit_LSM6DS33 lsm6ds33; + Adafruit_BMP280 bmp280; #else #error "Board is not supported" #endif @@ -84,10 +86,14 @@ uint16_t measure_button(uint8_t* buf, uint16_t bufsize) uint16_t measure_temperature(uint8_t* buf, uint16_t bufsize) { + float temp; #if defined ARDUINO_NRF52840_CIRCUITPLAY - float temp = CircuitPlayground.temperature(); - memcpy(buf, &temp, 4); + temp = CircuitPlayground.temperature(); +#else + temp = bmp280.readTemperature(); #endif + + memcpy(buf, &temp, 4); return 4; } @@ -156,10 +162,11 @@ void setup() // Accelerometer lsm6ds33.begin_I2C(); + + // Pressure + Temperature + bmp280.begin(); #endif - - // Setup the BLE LED to be enabled on CONNECT // Note: This is actually the default behaviour, but provided // here in case you want to control this LED manually via PIN 19