API Reference
adafruit_ble_adafruit.accelerometer_service
BLE access to accelerometer data.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.accelerometer_service.AccelerometerService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Accelerometer values.
- acceleration
Tuple (x, y, z) float acceleration values, in m/s^2
- measurement_period
Initially 1000ms.
adafruit_ble_adafruit.adafruit_service
Access to sensors and hardware on or connected to BLE-capable boards.
Author(s): Dan Halbert
Implementation Notes
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_ble_adafruit.adafruit_service.AdafruitServerAdvertisement(*, entry: ScanEntry | None = None)
Advertise the Adafruit company ID and the board USB PID.
- match_prefixes = (b'\xff"\x08\x04\x01\x00',)
For Advertisement,
match_prefixeswill always returnTrue. Subclasses may override this value.
- pid
The USB PID (product id) for this board.
- class adafruit_ble_adafruit.adafruit_service.AdafruitService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Common superclass for all Adafruit board services.
- static adafruit_service_uuid(n: int) VendorUUID
Generate a VendorUUID which fills in a 16-bit value in the standard Adafruit Service UUID: ADAFnnnn-C332-42A8-93BD-25E905756CB8.
adafruit_ble_adafruit.addressable_pixel_service
BLE control of addressable pixels, such as NeoPixels or DotStars.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.addressable_pixel_service.AddressablePixelService(service: AddressablePixelService | None = None)
Control of NeoPixels, DotStars, etc.
- pixel_buffer_size
0 = WS2812 (NeoPixel), 800kHz 1 = SPI (APA102: DotStar)
- pixel_pin
Send data out on this pin.
- property values: PixelValues | None
Return a tuple (start, write_now, data) corresponding to the different parts of
_pixel_packet.
- class adafruit_ble_adafruit.addressable_pixel_service.PixelValues(start, write_now, data)
Namedtuple for pixel data and instructions.
start
start writing data into buffer at this byte number (byte, not pixel)
write_now
Trueif data should be written to pixels now.Falseif write should not happen immediately.data
sequence of bytes of data for all pixels, in proper color order for type of pixel
- data
Alias for field number 2
- start
Alias for field number 0
- write_now
Alias for field number 1
adafruit_ble_adafruit.barometric_pressure_service
BLE access to barometric pressure data.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.barometric_pressure_service.BarometricPressureService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Barometric pressure value.
- measurement_period
Initially 1000ms.
- pressure
Barometric pressure in hectoPascals (hPa) (float)
- class adafruit_ble_adafruit.button_service.ButtonService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Status of buttons and switches on the board.
- measurement_period
send notification only on changes. -1 means stop reading.
- Type:
Initially 0
- pressed
slide switch: 1 for left; 0 for right bit 1: 1 if button A is pressed bit 2: 1 if button B is pressed other bits are available for future buttons and switches
- Type:
bit 0
adafruit_ble_adafruit.color_sensor_service
BLE access to color sensor data.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.color_sensor_service.ColorSensorService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Color sensor value.
- acceleration
Tuple (r, g, b) red/green/blue color values, each in range 0-65535 (16 bits)
- measurement_period
Initially 1000ms.
adafruit_ble_adafruit.gesture_service
BLE access to gesture detector.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.gesture_service.GestureService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Gesture sensor.
- DOWN = 2
swipe down
- LEFT = 3
swipe left
- RIGHT = 4
swipe right
- UP = 1
swipe up
- gesture
no gesture 1: swipe up (
UP) 2: swipe down (DOWN) 3: swipe left (LEFT) 4: swipe right (RIGHT)- Type:
0
- measurement_period
send notification only on changes. -1 means stop reading.
- Type:
Initially 0
adafruit_ble_adafruit.gyroscope_service
BLE access to gyroscope data.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.gyroscope_service.GyroscopeService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Gyroscope values.
- gyro
Tuple (x, y, z) float gyroscope values, in rad/s
- measurement_period
Initially 1000ms.
adafruit_ble_adafruit.humidity_service
BLE access to humidity data.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.humidity_service.HumidityService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Humidity sensor value.
- humidity
Relative humidity as a percentage, 0.0% - 100.0% (float)
- measurement_period
Initially 1000ms.
adafruit_ble_adafruit.light_sensor_service
BLE access to light sensor data.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.light_sensor_service.LightSensorService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Light sensor value.
- light_level
Uncalibrated light level (float)
- measurement_period
Initially 1000ms.
adafruit_ble_adafruit.magnetometer_service
BLE access to magnetometer data.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.magnetometer_service.MagnetometerService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Magnetometer values.
- magnetic
Tuple (x, y, z) float magnetometer values, in micro-Teslas (uT)
- measurement_period
Initially 1000ms.
adafruit_ble_adafruit.microphone_service
BLE access to microphone data.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.microphone_service.MicrophoneService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Digital microphone data.
- measurement_period
Initially 1000ms.
- number_of_channels
1 for mono, 2 for stereo (left and right)
- sound_samples
Array of 16-bit sound samples, varying based on period. If num_channel == 2, the samples alternate left and right channels.
adafruit_ble_adafruit.proximity_service
BLE access to proximity sensor.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.proximity_service.ProximityService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Status of buttons and switches on the board.
- measurement_period
send notification only on changes. -1 means stop reading.
- Type:
Initially 0
- proximity
A higher number indicates a closer distance to the sensor. The value is unit-less.
adafruit_ble_adafruit.quaternion_service
BLE access to quaternion data.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.quaternion_service.QuaternionService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Quaternion values.
- calibration_in
9-tuple of floats sent to client for calibration calculation: acceleration x, y, z, # in m/s^2 gyro x, y, z, # in rad/s magnetic x, y, z, # in microteslas
- calibration_out
19-tuple of floats sent back to server after calibration calculation: acceleration_zerog x, y, z, # in m/s^2 gyro_zerorate x, y, z, # in rad/s magnetic_hardiron x, y, z, # in microteslas magnetic_field f, # in microteslas magnetic_softiron v1, v2, v3, v4, v5, v6, v7, v8, v9, # unitless
- measurement_period
Initially 1000ms.
- quaternion
Tuple (qw, qx, qy, qz) of float quaternion values.
adafruit_ble_adafruit.temperature_service
BLE access to temperature data.
Author(s): Dan Halbert
- class adafruit_ble_adafruit.temperature_service.TemperatureService(*, service: Service | None = None, secondary: bool = False, **initial_values)
Temperature sensor.
- measurement_period
Initially 1000ms.
- temperature
Temperature in degrees Celsius (float).
adafruit_ble_adafruit.tone_service
BLE access to play tones.
Author(s): Dan Halbert