API Reference¶
- class seeed_xiao_nrf52840.IMU¶
IMU on Seeed XIAO nRF52840 Sense (only available on Sense models). This is an LSM6DS3 chip, and provides accelerometer and gyro readings. See https://docs.circuitpython.org/projects/lsm6dsox/en/latest/api.html for more details
Create an IMU instance. There are no arguments needed
- property acceleration: Tuple[float, float, float]¶
The x, y, z acceleration values returned in a 3-tuple and are in m / s ^ 2.
- property accelerometer_data_rate: int¶
Select the rate at which the accelerometer takes measurements. Must be a
Rate
- property accelerometer_range: int¶
Adjusts the range of values that the sensor can measure, from +/- 2G to +/-16G Note that larger ranges will be less accurate. Must be an
AccelRange
- property gyro: Tuple[float, float, float]¶
The x, y, z angular velocity values returned in a 3-tuple and are in radians / second
- property gyro_range: int¶
Adjusts the range of values that the sensor can measure, from 125 Degrees/s to 2000 degrees/s. Note that larger ranges will be less accurate. Must be a
GyroRange.
- load_mlc(ucf)¶
Load MLC configuration file into sensor
- pedometer_steps¶
The number of steps detected by the pedometer. You must enable with
pedometer_enablebefore calling. Usepedometer_resetto reset the number of steps
- read_mlc_output()¶
Read MLC results
- class seeed_xiao_nrf52840.Mic(*args: Any, **kwargs: Any)¶
On-board Microphone for Seeed XIAO nRF52840 Sense. Only available on Sense boards
Create a
Micobject. This allows you to record audio signals from the onboard microphone. The sample rate is fixed at 16000 and the bit depth is fixed at 16- Parameters
oversample (int) – Number of single bit samples to decimate into a final sample. Must be divisible by 8. Default is 64
Record 16-bit unsigned samples to buffer:
import audiobusio import board # Prep a buffer to record into. The array interface doesn't allow for # constructing with a set size so we append to it until we have the size # we want. b = array.array("H") for i in range(200): b.append(0) with Mic(sample_rate=16000) as mic: mic.record(b, len(b))
- deinit()¶
Turn off the microphone and release all resources
- record(destination: Union[array, bytearray, memoryview, rgbmatrix.RGBMatrix, ulab.numpy.ndarray], destination_length: int) None¶
Records destination_length bytes of samples to destination. This is blocking.
An IOError may be raised when the destination is too slow to record the audio at the given rate. For internal flash, writing all 1s to the file before recording is recommended to speed up writes.
- Returns
The number of samples recorded. If this is less than
destination_length, some samples were missed due to processing time.