Provides access to onboard sensors and battet
Project description
Introduction
Provides access to onboard sensors and battet
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.
Installing to a Connected CircuitPython Device with Circup
Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:
pip3 install circup
With circup installed and your CircuitPython device connected use the following command to install:
circup install seeed_xiao_nrf52840
Or the following command to update an existing version:
circup update
Usage Example
import array
import time
import audiocore
import audiopwmio
import board
from seeed_xiao_nrf52840 import IMU, Mic, Battery
with Battery() as bat:
print(f"Charge_status: {bat.charge_status}")
print(f"Voltage: {bat.voltage}")
print(f"Charge_current high?: {bat.charge_current}")
print("Setting charge current to high")
bat.charge_current = bat.CHARGE_100MA
print(f"Charge_current high?: {bat.charge_current}")
with IMU() as imu:
for i in range(5):
print("Acceleration:", imu.acceleration)
time.sleep(1)
with Mic() as mic:
for i in range(5):
print(f"Start speaking in: {5-i}")
time.sleep(1)
b = array.array("H")
for i in range(8000):
b.append(0)
print("SPEAK!!!")
mic.record(b, len(b))
print(b)
for i in range(5):
print(f"Replaying in: {5-i}")
time.sleep(1)
with audiopwmio.PWMAudioOut(board.D0) as aud:
print("PWM setup")
sample = audiocore.RawSample(b, sample_rate=8000)
print("sample ready")
aud.play(sample,loop=True)
print("playing")
time.sleep(5)
aud.stop()
Documentation
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file circuitpython-seeed-xiao-nrf52840-1.0.1.tar.gz
.
File metadata
- Download URL: circuitpython-seeed-xiao-nrf52840-1.0.1.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5da70d0e9b3fa82ba0203a3d90ad108c7f0bf2fefcadf36d37e7084970432c08 |
|
MD5 | d2d67bb0eae41c7fd55c52cf930b4cab |
|
BLAKE2b-256 | e5c7c75b5ebdeac8b87d191c9c33852ae19e8054008f25169992e30affc8702b |
Provenance
File details
Details for the file circuitpython_seeed_xiao_nrf52840-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: circuitpython_seeed_xiao_nrf52840-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a17946782a202a6e3bc1577d1b6632bb01302c97fe77ff47d1622f808a3970a4 |
|
MD5 | bbe703d8e13e3454f93251747b66a4a1 |
|
BLAKE2b-256 | 5ba273673aaaaf30f8a9af1008256ee63a3d45d1b091c2238c5edf4ed4e27170 |