An Arduino library for the Nano 33 BLE Sense that leverages Mbed OS to automatically place sensor measurements in a ring buffer that can be integrated into programs in a simple manner.
See The Arduino Nano 33 BLE Sense Sensor Library You Have Been Waiting For.
An Arduino library for the Nano 33 BLE Sense that leverages Mbed OS to automatically place sensor measurements in a ring buffer that can be integrated into programs in a simple manner.
Nano33BLESensor was created to help make easy to understand examples for the Arduino Nano 33 BLE Sense that utilise Mbed OS. For an example that does not use Mbed OS, please see nano-33-sense-serial-example
Download this file as a zip, and extract the resulting folder into your Arduino Libraries folder. See Installing Additional Arduino Libraries. Alternatively, use the Arduino IDE and library manager to find and install Nano33BLESensor.
Nano33BLESensor can be used with both the ArduinoCore-nRF528x-mbedos and ArduinoCore-mbed cores, however the Nano33BLESensorExample_microphoneRMS.ino example only currently compiles when using the ArduinoCore-nRF528x-mbedos core.
By default the ring buffer is only size of 20. No indication of buffer overflow is available, so it is up to the user to ensure the buffer is being read reguarly enough. Each sensor is read at differing intervals that are dependant on the sensors capabilities.
#include "Nano33BLEAccelerometer.h"
#include "Nano33BLEGyroscope.h"
#include "Nano33BLEMagnetic.h"
#include "Nano33BLEProximity.h"
#include "Nano33BLEColour.h"
#include "Nano33BLEGesture.h"
#include "Nano33BLEPressure.h"
#include "Nano33BLETemperature.h"
#include "Nano33BLEMicrophoneRMS.h"
void setup()
{
Magnetic.begin();
Gyroscope.begin();
Accelerometer.begin();
Proximity.begin();
Colour.begin();
Gesture.begin();
Pressure.begin();
Temperature.begin();
MicrophoneRMS.begin();
}
Nano33BLEAccelerometerData accelerometerData;
if(Accelerometer.pop(accelerometerData))
{
//Sensor value read from buffer
}
else
{
//Sensor value not ready (try again later)
}
uint32_t availableColourData;
availableColourData = Colour.availableDataSize();
if(availableColourData > 0)
{
Nano33BLEColourData colourData[availableColourData];
Colour.popMultiple(colourData, availableColourData);
}
pop() and popMultiple() can be used in a similar manner for all other sensors.
3-axis Accelerometer with BLE and serial output
3-axis Gyroscope with BLE and serial output
3-axis Magnetic with BLE and serial output
IMU sensors with BLE and serial output
RMS Microphone output with BLE and serial output
Barometric pressure with BLE and serial output
Temperature and humidity with BLE and serial output
Proximity with BLE and serial output
RGBC Colour with BLE and serial output