package
stringlengths
1
122
pacakge-description
stringlengths
0
1.3M
adafri
Adafri python module helper
adafruit-ampy
ampyMicroPython Tool (ampy) - Utility to interact with a CircuitPython or MicroPython board over a serial connection.Ampy is meant to be a simple command line tool to manipulate files and run code on a CircuitPython or MicroPython board over its serial connection. With ampy you can send files from your computer to the board's file system, download files from a board to your computer, and even send a Python script to a board to be executed.Note that ampy by design is meant to be simple and does not support advanced interaction like a shell or terminal to send input to a board. Check out other MicroPython tools likershellormpfshellfor more advanced interaction with boards.InstallationYou can use ampy with either Python 2.7.x or 3.x and can install it easily from Python's package index. On MacOS or Linux, in a terminal run the following command (assuming Python 3):pip3 install --user adafruit-ampyOn Windows, do:pip install adafruit-ampyNote on some Linux and Mac OSX systems you might need to run as root with sudo:sudo pip3 install adafruit-ampyIf you don't have Python 3 then try using Python 2 with:pip install adafruit-ampyOnce installed verify you can run the ampy program and get help output:ampy --helpYou should see usage information displayed like below:Usage: ampy [OPTIONS] COMMAND [ARGS]... ampy - Adafruit MicroPython Tool Ampy is a tool to control MicroPython boards over a serial connection. Using ampy you can manipulate files on the board's internal filesystem and even run scripts. Options: -p, --port PORT Name of serial port for connected board. [required] -b, --baud BAUD Baud rate for the serial connection. (default 115200) -d, --delay DELAY Delay in seconds before entering RAW MODE (default 0) --help Show this message and exit. Commands: get Retrieve a file from the board. ls List contents of a directory on the board. put Put a file on the board. rm Remove a file from the board. run Run a script and print its output.If you'd like to install from the Github source then use the standard Python setup.py install (or develop mode):python3 setup.py installNote to run the unit tests on Python 2 you must install the mock library:pip install mockUsageAmpy is made to talk to a CircuitPython MicroPython board over its serial connection. You will need your board connected and any drivers to access it serial port installed. Then for example to list the files on the board run a command like:ampy --port /dev/tty.SLAB_USBtoUART lsYou should see a list of files on the board's root directory printed to the terminal. Note that you'll need to change the port parameter to the name or path to the serial port that the MicroPython board is connected to.Other commands are available, run ampy with --help to see more information:ampy --helpEach subcommand has its own help, for example to see help for the ls command run (note you unfortunately must have a board connected and serial port specified):ampy --port /dev/tty.SLAB_USBtoUART ls --helpConfigurationFor convenience you can set anAMPY_PORTenvironment variable which will be used if the port parameter is not specified. For example on Linux or OSX:export AMPY_PORT=/dev/tty.SLAB_USBtoUART ampy lsOr on Windows (untested) try the SET command:set AMPY_PORT=COM4 ampy lsSimilarly, you can setAMPY_BAUDandAMPY_DELAYto control your baud rate and the delay before entering RAW MODE.To set these variables automatically each time you runampy, copy them into a file named.ampy:# Example .ampy file# Please fill in your own port, baud rate, and delayAMPY_PORT=/dev/cu.wchusbserial1410AMPY_BAUD=115200# Fix for macOS users' "Could not enter raw repl"; try 2.0 and lower from there:AMPY_DELAY=0.5You can put the.ampyfile in your working directory, one of its parents, or in your home directory.
adafruit-ampy-master
ampy replacementWe have been working on the next version of ampy which will solve various problems with the current system. Based on a new modular architecture, it makes adding device support and features very simple using plugins. It also aims to support coding over WiFi for supported devices. This should eliminate the need to have a wired connection and improve reliability as well.Hereis an alpha release please go ahead and play with it. Leave suggestions for a new name in the issue section. :)ampyMicroPython Tool (ampy) - Utility to interact with a CircuitPython or MicroPython board over a serial connection.Ampy is meant to be a simple command line tool to manipulate files and run code on a CircuitPython or MicroPython board over its serial connection. With ampy you can send files from your computer to the board's file system, download files from a board to your computer, and even send a Python script to a board to be executed.Note that ampy by design is meant to be simple and does not support advanced interaction like a shell or terminal to send input to a board. Check out other MicroPython tools likershellormpfshellfor more advanced interaction with boards.InstallationYou can use ampy with either Python 2.7.x or 3.x and can install it easily from Python's package index. On MacOS or Linux, in a terminal run the following command (assuming Python 3):pip3 install --user adafruit-ampyOn Windows, do:pip install adafruit-ampyNote on some Linux and Mac OSX systems you might need to run as root with sudo:sudo pip3 install adafruit-ampyIf you don't have Python 3 then try using Python 2 with:pip install adafruit-ampyOnce installed verify you can run the ampy program and get help output:ampy --helpYou should see usage information displayed like below:Usage: ampy [OPTIONS] COMMAND [ARGS]... ampy - Adafruit MicroPython Tool Ampy is a tool to control MicroPython boards over a serial connection. Using ampy you can manipulate files on the board's internal filesystem and even run scripts. Options: -p, --port PORT Name of serial port for connected board. [required] -b, --baud BAUD Baud rate for the serial connection. (default 115200) -d, --delay DELAY Delay in seconds before entering RAW MODE (default 0) --help Show this message and exit. Commands: get Retrieve a file from the board. ls List contents of a directory on the board. put Put a file on the board. rm Remove a file from the board. run Run a script and print its output.If you'd like to install from the Github source then use the standard Python setup.py install (or develop mode):python3 setup.py installNote to run the unit tests on Python 2 you must install the mock library:pip install mockUsageAmpy is made to talk to a CircuitPython MicroPython board over its serial connection. You will need your board connected and any drivers to access it serial port installed. Then for example to list the files on the board run a command like:ampy --port /dev/tty.SLAB_USBtoUART lsYou should see a list of files on the board's root directory printed to the terminal. Note that you'll need to change the port parameter to the name or path to the serial port that the MicroPython board is connected to.Other commands are available, run ampy with --help to see more information:ampy --helpEach subcommand has its own help, for example to see help for the ls command run (note you unfortunately must have a board connected and serial port specified):ampy --port /dev/tty.SLAB_USBtoUART ls --helpConfigurationFor convenience you can set anAMPY_PORTenvironment variable which will be used if the port parameter is not specified. For example on Linux or OSX:export AMPY_PORT=/dev/tty.SLAB_USBtoUART ampy lsOr on Windows (untested) try the SET command:set AMPY_PORT=COM4 ampy lsSimilarly, you can setAMPY_BAUDandAMPY_DELAYto control your baud rate and the delay before entering RAW MODE.To set these variables automatically each time you runampy, copy them into a file named.ampy:# Example .ampy file# Please fill in your own port, baud rate, and delayAMPY_PORT=/dev/cu.wchusbserial1410AMPY_BAUD=115200# Fix for macOS users' "Could not enter raw repl"; try 2.0 and lower from there:AMPY_DELAY=0.5You can put the.ampyfile in your working directory, one of its parents, or in your home directory.
adafruit-blinka-bleio
Introduction_bleiofor Blinka based onbleakand bluez.DependenciesThis driver depends on:bleakIt optionally also depends on these Debian packages not install on Raspbian by default:bluez-hcidumpInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-blinka-bleioTo install system-wide (this may be required in some cases):sudopip3installadafruit-blinka-bleioTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.envsource.env/bin/activatepip3installadafruit-blinka-bleioSupport for Duplicate Advertisement scanning on LinuxNoteRead this section if you are using advertising to transmit changing data and need to receive all advertisements to receive this data. One example of using advertising for data is described in the Adafruit Learn GuideBluetooth LE Sensor Nodes to Raspberry Pi WiFi Bridge.The regular Linux kernelbluezdriver is set up to suppress multiple advertisements sent from the same BLE device. As of this writing, this cannot be changed. If you are using BLE advertisements to send changing data that you retrieve by scanning, the de-duplication can cause you to lose data when scanning viableak.To get around this problem, this library can instead look at raw BLE scanning data using thehcidumpandhcitooltools and avoid going through the kernel driver. But this requires special setup.Normally, only root has enough privileges to do see the raw scanning data. Since running as root is dangerous, you can instead use Linux capabilities to granthcitoolandhcidumpraw network access. This is very powerful and not something to do casually. To limit access we recommend you change file execution permissions to restrict this capability to users in thebluetoothgroup.If you are not using advertising to transmit changing data, you do not need to add these permissions. This library falls back to usingbleakfor regular scanning ifhcitooldoes not have these extra permissions.If youexplicitlywant to choose the backend to ensure consistent behavior, you can do the following:ble=BLERadio()ble._adapter.ble_backend="bleak"# Forces bleak even if hcitool works.# ble._adapter.ble_backend = "hcitool" # Forces hcitool. Raises exception if unavailable.To add yourself to thebluetoothgroup do:sudousermod-a-Gbluetooth<yourusername>You must then logout and log back in to be in the new group.To set permissions onhcitoolandhcidumpdo:sudochown:bluetooth/usr/bin/hcitool/usr/bin/hcidumpsudochmodo-x/usr/bin/hcitool/usr/bin/hcidumpsudosetcap'cap_net_raw,cap_net_admin+eip'/usr/bin/hcitoolsudosetcap'cap_net_raw,cap_net_admin+eip'/usr/bin/hcidumpUsage ExampleDo not use this library directly. Use CircuitPython BLE instead:https://github.com/adafruit/Adafruit_CircuitPython_BLE/ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.DocumentationFor information on building library documentation, please check outthis guide.TroubleshootingRaspberry Pi 3b Rev 1.2The Raspberry Pi 3b’s BLE chip is connected over UART to the main processor without flow control. This can cause unreliability with BLE. To improve reliability, we can slow the UART. To do so, edit/usr/bin/btuartand replace the921600with460800.
adafruit-blinka-displayio
Introductiondisplayio for BlinkaDependenciesThis driver depends on:Adafruit BlinkaInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-blinka-displayioTo install system-wide (this may be required in some cases):sudopip3installadafruit-blinka-displayioTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.envsource.env/bin/activatepip3installadafruit-blinka-displayioContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.DocumentationFor information on building library documentation, please check outthis guide.
adafruit-blinka-pyportal
IntroductionA port of the PyPortal library intended to run on Blinka in CPython.DependenciesThis driver depends on:Adafruit BlinkaAdafruit Blinka DisplayIOInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-blinka-pyportalTo install system-wide (this may be required in some cases):sudopip3installadafruit-blinka-pyportalTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.envsource.env/bin/activatepip3installadafruit-blinka-pyportalContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.DocumentationFor information on building library documentation, please check outthis guide.
adafruit-board-toolkit
IntroductionCircuitPython board identification and informationInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-board-toolkitTo install system-wide (this may be required in some cases):sudopip3installadafruit-board-toolkitTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.envsource.env/bin/activatepip3installadafruit-board-toolkitContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-24lc32
IntroductionCircuitPython driver for Adafruit 24LC32 I2C EEPROM BreakoutDependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Adafruit 24LC32 I2C EEPROM BreakoutPurchase one from the Adafruit shopInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-24lc32To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-24lc32To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-24lc32Installing to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstalladafruit_24lc32Or the following command to update an existing version:circupupdateUsage Exampleimportboardimportadafruit_24lc32i2c=board.I2C()eeprom=adafruit_24lc32.EEPROM_I2C(i2c)print("length:{}".format(len(eeprom)))eeprom[0]=4print(eeprom[0])whileTrue:passDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-74hc595
IntroductionCircuitPython driver for 74HC595 shift register.DependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-74hc595To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-74hc595To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-74hc595Usage Exampleimportboardimportadafruit_74hc595importbusioimportdigitalioimporttimespi=busio.SPI(board.SCK,MOSI=board.MOSI)latch_pin=digitalio.DigitalInOut(board.D5)sr=adafruit_74hc595.ShiftRegister74HC595(spi,latch_pin)pin1=sr.get_pin(1)whileTrue:pin1.value=Truetime.sleep(1)pin1.value=Falsetime.sleep(1)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-acep7in
IntroductionDriver for 7.3” 7-color (aka ACeP) epaper displayDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Waveshare 7.3” FInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-acep7inTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-acep7inTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.env/bin/activatepip3installadafruit-circuitpython-acep7inInstalling to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstalladafruit_acep7inOr the following command to update an existing version:circupupdateUsage Example# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries# SPDX-FileCopyrightText: Copyright (c) 2023 Scott Shawcroft for Adafruit Industries# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries## SPDX-License-Identifier: Unlicense"""Simple test script for 5.6" 600x448 7-color ACeP display. """# pylint: disable=no-memberimporttimeimportboardimportdisplayioimportadafruit_acep7in# For 8.x.x and 9.x.x. When 8.x.x is discontinued as a stable release, change this.try:fromfourwireimportFourWireexceptImportError:fromdisplayioimportFourWiredisplayio.release_displays()# This pinout works on a Feather RP2040 and may need to be altered for other boards.spi=board.SPI()# Uses SCK and MOSIepd_cs=board.D9epd_dc=board.D10epd_reset=board.D11epd_busy=board.D12display_bus=FourWire(spi,command=epd_dc,chip_select=epd_cs,reset=epd_reset,baudrate=1000000)display=adafruit_acep7in.ACeP7In(display_bus,width=800,height=480,busy_pin=epd_busy)g=displayio.Group()fn="/display-ruler-720p.bmp"withopen(fn,"rb")asf:pic=displayio.OnDiskBitmap(f)t=displayio.TileGrid(pic,pixel_shader=pic.pixel_shader)g.append(t)display.root_group=gdisplay.refresh()time.sleep(120)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ad569x
IntroductionCircuitPython driver for the AD5691/2/3 I2C DACDependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Purchase one from the Adafruit shopInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ad569xTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ad569xTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.envsource.env/bin/activatepip3installadafruit-circuitpython-ad569xInstalling to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstalladafruit--circuitpython-ad569xOr the following command to update an existing version:circupupdateUsage Exampleimportboardimportadafruit_ad569xi2c=board.I2C()dac=adafruit_ad569x.Adafruit_AD569x(i2c)# length of the sine waveLENGTH=100# sine wave values written to the DACvalue=[int(math.sin(math.pi*2*i/LENGTH)*((2**15)-1)+2**15)foriinrange(LENGTH)]whileTrue:forvinvalue:dac.value=vDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-adafruitio
Adafruit_CircuitPython_AdafruitIOCircuitPython wrapper library for communicating withAdafruit IO.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure that all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-adafruitioTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-adafruitioTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-adafruitioUsage ExampleUsage examples for the Adafruit IO HTTP API are within the examples/http folder.Usage examples for the Adafruit IO MQTT API are within the examples/mqtt folder.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ads1x15
IntroductionSupport for the ADS1x15 series of analog-to-digital converters. Available in 12-bit (ADS1015) and 16-bit (ADS1115) versions.Installation & DependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This can be most easily achieved by downloading and installingthe Adafruit library and driver bundleon your device.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ads1x15To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ads1x15To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ads1x15Usage ExampleSingle Endedimporttimeimportboardimportbusioimportadafruit_ads1x15.ads1015asADSfromadafruit_ads1x15.analog_inimportAnalogIn# Create the I2C busi2c=busio.I2C(board.SCL,board.SDA)# Create the ADC object using the I2C busads=ADS.ADS1015(i2c)# Create single-ended input on channel 0chan=AnalogIn(ads,ADS.P0)# Create differential input between channel 0 and 1#chan = AnalogIn(ads, ADS.P0, ADS.P1)print("{:>5}\t{:>5}".format('raw','v'))whileTrue:print("{:>5}\t{:>5.3f}".format(chan.value,chan.voltage))time.sleep(0.5)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ads7830
IntroductionCircuitPython driver for the ADS7830 analog to digital converterDependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Purchase one from the Adafruit shopInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ads7830To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ads7830To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.env/bin/activatepip3installadafruit-circuitpython-ads7830Installing to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstalladafruit_ads7830Or the following command to update an existing version:circupupdateUsage Exampleimporttimeimportboardimportadafruit_ads7830i2c=board.I2C()# Initialize ADS7830adc=adafruit_ads7830.Adafruit_ADS7830(i2c)analog_inputs=[]foriinrange(8):c=adc.inputs[i]analog_inputs.append(c)whileTrue:foriinenumerate(analog_inputs):print(f"ADC input{i}={analog_inputs[i].value}")time.sleep(0.1)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-adt7410
IntroductionCircuitPython driver for reading temperature from the Analog Devices ADT7410 precision temperature sensorDependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-adt7410To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-adt7410To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-adt7410Usage Exampleimporttimeimportboardimportadafruit_adt7410i2c=board.I2C()# uses board.SCL and board.SDAadt=adafruit_adt7410.ADT7410(i2c,address=0x48)adt.high_resolution=TruewhileTrue:print(adt.temperature)time.sleep(0.5)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-adxl34x
IntroductionA CircuitPython driver for the ADXL34x family of accelerometersDependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-adxl34xTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-adxl34xTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-adxl34xUsage Exampleimporttimeimportboardimportadafruit_adxl34xi2c=board.I2C()# uses board.SCL and board.SDAaccelerometer=adafruit_adxl34x.ADXL345(i2c)whileTrue:print("%f%f%f"%accelerometer.acceleration)time.sleep(1)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-adxl37x
IntroductionA CircuitPython I2C driver for the ADXL37x family of accelerometersDependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceADXL34xPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.This library works with the ADXL375 accelerometer breakout over I2C.Purchase one from the Adafruit shopInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-adxl37xTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-adxl37xTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-adxl37xInstalling to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstalladafruit_adxl37xOr the following command to update an existing version:circupupdateUsage Exampleimporttimeimportboardimportadafruit_adxl37xi2c=board.I2C()accelerometer=adafruit_adxl37x.ADXL375(i2c)whileTrue:print("%f%f%f"%accelerometer.acceleration)time.sleep(0.2)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ags02ma
IntroductionAGS02MA TVOC / Gas sensorDependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Purchase one from the Adafruit shopInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ags02maTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ags02maTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.envsource.env/bin/activatepip3installadafruit-circuitpython-ags02maInstalling to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstallags02maOr the following command to update an existing version:circupupdateUsage ExampleSee theexamples/folder to example usage of this library.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ahtx0
IntroductionCircuitPython driver for the Adafruit AHT10 or AHT20 Humidity and Temperature SensorDependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ahtx0To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ahtx0To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ahtx0Usage Exampleimporttimeimportboardimportadafruit_ahtx0# Create sensor object, communicating over the board's default I2C busi2c=board.I2C()# uses board.SCL and board.SDAsensor=adafruit_ahtx0.AHTx0(i2c)whileTrue:print("\nTemperature:%0.1fC"%sensor.temperature)print("Humidity:%0.1f%%"%sensor.relative_humidity)time.sleep(2)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-airlift
IntroductionManage AirLift coprocessors for use with Wifi and BluetoothDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-airliftTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-airliftTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-airliftUsage ExampleExample:from adafruit_airlift.esp32 import ESP32 import _bleio esp32 = ESP32(debug=True) _bleio.set_adapter(esp32.start_bluetooth())DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-am2320
IntroductionThis is a CircuitPython driver for the AM2320 temperature and humidity sensor.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-am2320To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-am2320To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-am2320Usage ExampleSeeam2320_simpletest.pyin the examples folder.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-amg88xx
IntroductionAdafruit CircuitPython module for the AMG88xx GRID-Eye IR 8x8 thermal camera.DependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-amg88xxTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-amg88xxTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-amg88xxUsage ExampleOf course, you must import the library to use it:importbusioimportadafruit_amg88xxThe way to create an I2C object depends on the board you are using. For boards with labeled SCL and SDA pins, you can:importboardYou can also use pins defined by the onboard microcontroller through the microcontroller.pin module.Now, to initialize the I2C bus:i2c_bus=busio.I2C(board.SCL,board.SDA)Once you have created the I2C interface object, you can use it to instantiate the AMG88xx objectamg=adafruit_amg88xx.AMG88XX(i2c_bus)You can also optionally use the alternate i2c address (make sure to solder the jumper on the back of the board if you want to do this)amg=adafruit_amg88xx.AMG88XX(i2c_bus,addr=0x68)Pixels can be then be read by doing:print(amg.pixels)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-apds9960
IntroductionThe APDS-9960 is a specialized chip that detects hand gestures, proximity and ambient light color over I2C. Its available fromAdafruit as a breakoutand as a built-in sensor on several Adafruit development boards.Adafruit CLUEAdafruit Feather nRF52840 SenseAdafruit Proximity TrinkeyThis driver provides easy access to proximity, gesture and color data from the APDS-9960 sensor with a minimal footprint to allow it to work on all CircuitPython platforms.Installation and DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem.This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI.To install for current user:pip3installadafruit-circuitpython-apds9960To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-apds9960To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-apds9960Usage Exampleimportboardimportdigitaliofromadafruit_apds9960.apds9960importAPDS9960i2c=board.I2C()int_pin=digitalio.DigitalInOut(board.D5)int_pin.switch_to_input(pull=digitalio.Pull.UP)apds=APDS9960(i2c)apds.enable_proximity_interrupt=Trueapds.proximity_interrupt_threshold=(0,175)apds.enable_proximity=TruewhileTrue:ifnotint_pin.value:print(apds.proximity)apds.clear_interrupt()Hardware Set-upIf you’re using a board with a built-in APDS-9960, no hardware setup will be required.If you’re using a breakout board via the pin header, connectVinto a 3.3 V or 5 V power source, connectGNDto ground, then connectSCLandSDAto the appropriate pins.Optionally, if you’d like to use the sensor’s interrupt pin connectINTto any available digital I/O pin.BasicsTo get started, importboardand, and this library:importboardfromadafruit_apds9960.apds9960importAPDS9960To set up the sensor to gather data, initialize the I2C bus viaboard.I2C()then initialize the APDS-9960 library.i2c=board.I2C()apds=APDS9960(i2c)ProximityTo get a proximity result, enable the proximity engine then read theproximityvalue.This will return a value between 0 and 255, with higher values indicating that something is close to the sensor.apds.enable_proximity=TruewhileTrue:print(apds.proximity)GesturesFirst, enable both the proximity and gesture engines. The gesture engine relies on the proximity engine to determine when to start itself up and, as a result, proximity readings won’t be reliable while the gesture engine is enabled.To get a gesture, use thegesture()function to see if a gesture has been detected. If a value greater than 0 is returned, a gesture has been detected.# Uncomment and set the rotation if depending on how your sensor is mounted.# apds.rotation = 270 # 270 for CLUEapds.enable_proximity=Trueapds.enable_gesture=TruewhileTrue:gesture=apds.gesture()ifgesture==1:print("up")ifgesture==2:print("down")ifgesture==3:print("left")ifgesture==4:print("right")Color/Light MeasurementTo get a color measurement, first enable the color/light engine, wait for color data to arrive, then read thecolor_datavalues.apds.enable_color=TruewhileTrue:whilenotapds.color_data_ready:time.sleep(0.005)r,g,b,c=apds.color_dataprint("r:{}, g:{}, b:{}, c:{}".format(r,g,b,c))Interrupt PinThis sensor has an interrupt pin can be asserted (pulled low) if proximity is detected outside of a specified window of values.For boards with a built-in APDS-9960 this interupt pin will already be defined. For example, on the Clue and Feather nRF52840 Sense boards this pin is mapped toboard.PROXIMITY_LIGHT_INTERRUPTand on the Proximity Trinkey it is mapped toboard.INTERRUPT.int_pin=digitalio.DigitalInOut(board.D5)int_pin.switch_to_input(pull=digitalio.Pull.UP)Proximity DetectionWith the interrupt pin set up we can define a threshold and enable the assertion of the sensor’s interrupt pin by the proximity engine before enabling the proximity engine itself.In this configuration, the sensor’s interrupt pin will be asserted when an object is close to the sensor. After checking on the interrupt it can be cleared usingclear_interrupt()apds.enable_proximity=True# set the interrupt threshold to fire when proximity reading goes above 175apds.proximity_interrupt_threshold=(0,175)# assert interrupt pin on internal proximity interruptapds.enable_proximity_interrupt=True# enable the sensor's proximity engineapds.enable_proximity=TruewhileTrue:ifnotinterrupt_pin.value:print(apds.proximity)# clear the interruptapds.clear_interrupt()Initiaization OptionsBy default, when the driver is initialized, the APDS-9960 sensor’s internal settings are reset and sensible defaults are applied to several low-level settings that should work well for most use cases.If either the “reset” or “set defaults” behaviors (or both) aren’t desired, they can be individually disabled via init kwargs.apds=APDS9960(i2c,reset=False,set_defaults=False)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.Building locallyTo build this library locally you’ll need to install thecircuitpython-travis-build-toolspackage.Once installed, make sure you are in the virtual environment:Then run the build:Sphinx documentationSphinx is used to build the documentation based on rST files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):python3-mvenv.venvsource.venv/bin/activatepipinstallSphinxsphinx-rtd-themeNow, once you have the virtual environment activated:cddocssphinx-build-E-W-bhtml._build/htmlThis will output the documentation todocs/_build/html. Open the index.html in your browser to view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to locally verify it will pass.
adafruit-circuitpython-as726x
IntroductionDriver for the AS726x spectral sensorsInstallation and DependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-as726xTo install system-wide (this may be required in some cases:sudopip3installadafruit-circuitpython-as726xTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-as726xDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-as7341
IntroductionCircuitPython library for use with the Adafruit AS7341 breakout.NOTE: Due to the size of this library, it may not work on M0 (ex: Trinket M0) and other low memory boards.DependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-as7341To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-as7341To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-as7341Usage Examplefromtimeimportsleepimportboardfromadafruit_as7341importAS7341i2c=board.I2C()# uses board.SCL and board.SDAsensor=AS7341(i2c)defbar_graph(read_value):scaled=int(read_value/1000)return"[%5d] "%read_value+(scaled*"*")whileTrue:print("F1 - 415nm/Violet%s"%bar_graph(sensor.channel_415nm))print("F2 - 445nm//Indigo%s"%bar_graph(sensor.channel_445nm))print("F3 - 480nm//Blue%s"%bar_graph(sensor.channel_480nm))print("F4 - 515nm//Cyan%s"%bar_graph(sensor.channel_515nm))print("F5 - 555nm/Green%s"%bar_graph(sensor.channel_555nm))print("F6 - 590nm/Yellow%s"%bar_graph(sensor.channel_590nm))print("F7 - 630nm/Orange%s"%bar_graph(sensor.channel_630nm))print("F8 - 680nm/Red%s"%bar_graph(sensor.channel_680nm))print("Clear%s"%bar_graph(sensor.channel_clear))print("Near-IR (NIR)%s"%bar_graph(sensor.channel_nir))print("\n------------------------------------------------")sleep(1)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-asyncio
IntroductionCooperative multitasking and asynchronous I/OThe code in this library is largely based on theMicroPython uasyncio implementation.DependenciesThis driver depends on:Adafruit CircuitPythonTicksPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Installing from PyPIThis library is meant to be a subset of the `asynciomodule in CPython <https://docs.python.org/3/library/asyncio.html>`_, and will not be made available on PyPI. Use the CPython version instead.Installing to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstallasyncioOr the following command to update an existing version:circupupdateDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-atecc
IntroductionDriver forMicrochip’s ATECCx08 cryptographic co-processors with secure hardware-based key storage.Note: This library was developed and tested with an ATECC608A, but should work for ATECC508 modules as well.DependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ateccTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ateccTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ateccUsage ExampleExamples of using this module are in examples folder.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-avrprog
IntroductionProgram your favorite AVR chips directly from CircuitPython with this handy helper class that will let you make stand-alone programmers right from your REPL. Should work with any/all AVR chips, via SPI programming. Tested with ATmega328, ATtiny85 and ATmega2560DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-avrprogTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-avrprogTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-avrprogUsage ExampleSee examples folder for full examples that progam various bootloaders onto chips.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-aw9523
IntroductionPython library for AW9523 GPIO expander and LED driverDependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-aw9523To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-aw9523To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-aw9523Usage Exampleimportboardimportdigitalioimportadafruit_aw9523i2c=board.I2C()aw=adafruit_aw9523.AW9523(i2c)led_pin=aw.get_pin(0)# LED on AW9523 io 0button_pin=aw.get_pin(1)# Button on AW io 1# LED is an output, initialize to highled_pin.switch_to_output(value=True)# Button is an input, note internal pull-ups are not supported!button_pin.direction=digitalio.Direction.INPUTwhileTrue:# LED mirrors button pinled_pin.value=button_pin.valueDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-aws-iot
IntroductionAmazon AWS IoT MQTT Client for CircuitPython.Note: This library requires version>=1.4.0of theAdafruit fork of the Arduino NINA-W102 firmwareinstalled on your ESP32 Airlift/WiFi Co-Processor.If you do not know how to do this,visit the Adafruit Learning System guide for this topic…DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-aws-iotTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-aws-iotTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-aws-iotUsage ExampleLibrary examples within examples/ folder.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-azureiot
Adafruit_CircuitPython_AzureIoTA CircuitPython device library forMicrosoft Azure IoT Servicesfrom a CircuitPython device. This library only supports key-base authentication, it currently doesn’t support X.509 certificates.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-azureiotTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-azureiotTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-azureiotDependenciesThis driver depends on:Adafruit CircuitPythonAdafruit CircuitPython MiniMQTTAdafruit CircuitPython RequestsAdafruit CircuitPython BinASCIIAdafruit CircuitPython LoggingPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Board Compatibility:The following built-in modules must be available: gc, json, ssl, timeUsage ExampleThis library supports bothAzure IoT HubandAzure IoT Central.To create an Azure IoT Hub instance or an Azure IoT Central app, you will need an Azure subscription. If you don’t have an Azure subscription, you can sign up for free:If you are a student 18 or over, head toaka.ms/FreeStudentAzureand sign up, validating with your student email address. This will give you $100 of Azure credit and free tiers of a load of service, renewable each year you are a student. You will not need a credit card.If you are not a student, head toaka.ms/FreeAzand sign up to get $200 of credit for 30 days, as well as free tiers of a load of services. You will need a credit card for validation only, your card will not be charged.ESP32 AirLift NetworkingTo use this library, you will need to create an ESP32_SPI WifiManager, connected to WiFi. You will also need to set the current time, as this is used to generate time-based authentication keys. One way to do this is with the following code:# get_time will raise ValueError if the time isn't available yet so loop until# it works.now_utc=Nonewhilenow_utcisNone:try:now_utc=time.localtime(esp.get_time()[0])exceptValueError:passrtc.RTC().datetime=now_utcNative NetworkingTo use this library, with boards that have native networking support, you need to be connected to a network. You will also need to set the current time, as this is used to generate time-based authentication keys. One way to do this is theAdafruit NTP librarywith the following code:pool=socketpool.SocketPool(wifi.radio)ntp=adafruit_ntp.NTP(pool,tz_offset=0)# NOTE: This changes the system time so make sure you aren't assuming that time# doesn't jump.rtc.RTC().datetime=ntp.datetimeAzure IoT HubTo interact with Azure IoT Hub, you will need to create a hub, and a register a device inside that hub. There is a free tier available, and this free tier allows up to 8,000 messages a day, so try not to send messages too often if you are using this tier.Open theAzure Portal.Follow the instructions inMicrosoft Docsto create an Azure IoT Hub and register a device.Copy the devices Primary or secondary connection string, and add this to yoursecrets.pyfile.You can find the device connection string by selecting the IoT Hub in theAzure Portal,selecting Explorer -> IoT devices, then selecting your device.Locating the device in the IoT hub bladeThen copy either the primary or secondary connection string using the copy button next to the value.Copy the primary connection stringConnect your device to Azure IoT Hubfromadafruit_azureiotimportIoTHubDevicedevice=IoTHubDevice(wifi,secrets["device_connection_string"])device.connect()Once the device is connected, you will regularly need to run aloopto poll for messages from the cloud.whileTrue:device.loop()time.sleep(1)Send a device to cloud messagemessage={"Temperature":temp}device.send_device_to_cloud_message(json.dumps(message))Receive device to cloud messagesdefcloud_to_device_message_received(body:str,properties:dict):print("Received message with body",body,"and properties",json.dumps(properties))# Subscribe to cloud to device messagesdevice.on_cloud_to_device_message_received=cloud_to_device_message_receivedReceive direct methodsdefdirect_method_invoked(method_name:str,payload)->IoTResponse:print("Received direct method",method_name,"with data",str(payload))# return a status code and message to indicate if the direct method was handled correctlyreturnIoTResponse(200,"OK")# Subscribe to direct methodsdevice.on_direct_method_invoked=direct_method_invokedUpdate reported properties on the device twinThis is not supported on Basic tier IoT Hubs, only on the free and standard tiers.patch={"Temperature":temp}device.update_twin(patch)Subscribe to desired property changes on the device twinThis is not supported on Basic tier IoT Hubs, only on the free and standard tiers.defdevice_twin_desired_updated(desired_property_name:str,desired_property_value,desired_version:int):print("Property",desired_property_name,"updated to",str(desired_property_value),"version",desired_version)# Subscribe to desired property changesdevice.on_device_twin_desired_updated=device_twin_desired_updatedAzure IoT CentralTo use Azure IoT Central, you will need to create an Azure IoT Central app, create a device template and register a device against the template.Head toAzure IoT CentralFollow the instructions in theMicrosoft Docsto create an application. Every tier is free for up to 2 devices.Follow the instructions in theMicrosoft Docsto create a device template.Create a device based off the template, and selectConnectto get the device connection details. Store the ID Scope, Device ID and either the primary or secondary device SAS key in yoursecrets.pyfile.The connect buttonThe connection details dialogsecrets={# WiFi settings"ssid":"","password":"",# Azure IoT Central settings"id_scope":"","device_id":"","device_sas_key":""}Connect your device to your Azure IoT Central appfromadafruit_azureiotimportIoTCentralDevicedevice=IoTCentralDevice(wifi,secrets["id_scope"],secrets["device_id"],secrets["device_sas_key"])device.connect()Once the device is connected, you will regularly need to run aloopto poll for messages from the cloud.whileTrue:device.loop()time.sleep(1)Send telemetrymessage={"Temperature":temp}device.send_telemetry(json.dumps(message))Listen for commandsdefcommand_executed(command_name:str,payload)->IoTResponse:print("Command",command_name,"executed with payload",str(payload))# return a status code and message to indicate if the command was handled correctlyreturnIoTResponse(200,"OK")# Subscribe to commandsdevice.on_command_executed=command_executedUpdate propertiesdevice.send_property("Desired_Temperature",temp)Listen for property updatesdefproperty_changed(property_name,property_value,version):print("Property",property_name,"updated to",str(property_value),"version",str(version))# Subscribe to property updatesdevice.on_property_changed=property_changedLearning more about Azure IoT servicesIf you want to learn more about setting up or using Azure IoT Services, check out the following resources:Azure IoT documentation on Microsoft DocsIoT learning paths and modules on Microsoft Learn- Free, online, self-guided hands on learning with Azure IoT servicesDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bd3491fs
IntroductionCircuitPython library for the Rohm BD3491FS Audio ProcessorDependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bd3491fsTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bd3491fsTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bd3491fsUsage Exampleimportboardimportadafruit_bd3491fsimportbusioi2c=busio.I2C(board.SCL,board.SDA)bd3491fs=adafruit_bd3491fs.BD3491FS(i2c)bd3491fs.active_input=adafruit_bd3491fs.Input.Abd3491fs.input_gain=adafruit_bd3491fs.Level.LEVEL_20DBbd3491fs.channel_1_attenuation=0bd3491fs.channel_2_attenuation=0DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bh1750
IntroductionCircuitPython library for use with the Adafruit BH1750 Ambient Light Sensor BreakoutDependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bh1750To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bh1750To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bh1750Usage Exampleimporttimeimportboardimportadafruit_bh1750i2c=board.I2C()sensor=adafruit_bh1750.BH1750(i2c)whileTrue:print("%.2fLux"%sensor.lux)time.sleep(1)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-binascii
IntroductionThe binascii module contains a number of methods to convert between binary and various ASCII-encoded binary representations.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-binasciiTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-binasciiTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-binasciiUsage ExampleHex <-> Binary Conversionsfromadafruit_binasciiimporthexlify,unhexlify# Binary data.data=b"CircuitPython is Awesome!"# Get the hexadecimal representation of the binary datahex_data=hexlify(data)print("Hex Data: ",hex_data)# Get the binary data represented by hex_databin_data=unhexlify(hex_data)print("Binary Data: ",bin_data)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bitbangio
IntroductionA library for adding bitbang I2C and SPI to CircuitPython without the built-in bitbangio module. The interface is intended to be the same as bitbangio and therefore there is no bit order or chip select functionality. If your board supports bitbangio, it is recommended to use that instead as the timing should be more reliable.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bitbangioTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bitbangioTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bitbangioUsage Example""" This example is for demonstrating how to retrieving the board ID from a BME280, which is stored in register 0xD0. It should return a result of [96] """importboardimportdigitalioimportadafruit_bitbangioasbitbangio# Change these to the actual connectionsSCLK_PIN=board.D6MOSI_PIN=board.D17MISO_PIN=board.D18CS_PIN=board.D5cs=digitalio.DigitalInOut(CS_PIN)cs.switch_to_output(value=True)spi=bitbangio.SPI(SCLK_PIN,MOSI=MOSI_PIN,MISO=MISO_PIN)cs.value=0whilenotspi.try_lock():passspi.write([0xD0])data=[0x00]spi.readinto(data)spi.unlock()cs.value=1print("Result is{}".format(data))DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bitmap-font
IntroductionLoads bitmap fonts into CircuitPython’s displayio. BDF and PCF files are well supported. TTF support is not yet complete.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bitmap_fontTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bitmap_fontTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bitmap_fontUsage Examplefromadafruit_bitmap_fontimportbitmap_fontfromdisplayioimportBitmapfont=bitmap_font.load_font("fonts/LeagueSpartan-Bold-16.bdf",Bitmap)print(font.get_glyph(ord("A")))Creating FontsSeethis learn guidefor more information about building custom fornt filesThe command line toolotf2bdfcan be used make bdf files for use with this library.The command line toolbdftopcfcan be used make pcf files for use with this library.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bitmapsaver
IntroductionSave a displayio.Bitmap (and associated displayio.Palette) into a BMP file.DependenciesThis driver depends on:Adafruit CircuitPythonCircuitPython 5.0 or later is required.Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bitmapsaverTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bitmapsaverTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bitmapsaverUsage ExampleimportboardimportbusioimportdigitaliofromdisplayioimportBitmap,Paletteimportadafruit_sdcardimportstoragefromadafruit_bitmapsaverimportsave_pixelsprint('Setting up SD card')spi=busio.SPI(board.SCK,MOSI=board.MOSI,MISO=board.MISO)cs=digitalio.DigitalInOut(board.SD_CS)sdcard=adafruit_sdcard.SDCard(spi,cs)vfs=storage.VfsFat(sdcard)storage.mount(vfs,"/sd")WHITE=0xFFFFFFBLACK=0x000000RED=0xFF0000ORANGE=0xFFA500YELLOW=0xFFFF00GREEN=0x00FF00BLUE=0x0000FFPURPLE=0x800080PINK=0xFFC0CBcolors=(BLACK,RED,ORANGE,YELLOW,GREEN,BLUE,PURPLE,WHITE)print('Building sample bitmap and palette')bitmap=Bitmap(16,16,9)palette=Palette(len(colors))fori,cinenumerate(colors):palette[i]=cforxinrange(16):foryinrange(16):ifx==0ory==0orx==15ory==15:bitmap[x,y]=1elifx==y:bitmap[x,y]=4elifx==15-y:bitmap[x,y]=5else:bitmap[x,y]=0print('Saving bitmap')save_pixels('/sd/test.bmp',bitmap,palette)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble
IntroductionThis module provides higher-level BLE (Bluetooth Low Energy) functionality, building on the native_bleiomodule.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIWarning: Linux support isverylimited. SeeAdafruit Blinka _bleiofor details.On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bleTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bleTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bleUsage Examplefromadafruit_bleimportBLERadioradio=BLERadio()print("scanning")found=set()forentryinradio.start_scan(timeout=60,minimum_rssi=-80):addr=entry.addressifaddrnotinfound:print(entry)found.add(addr)print("scan done")DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-adafruit
IntroductionBLE Adafruit ServiceDependenciesThis driver depends on:Adafruit CircuitPythonCircuitPython must be at least version 6.0.0.Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-adafruitTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-adafruitTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-adafruitDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-apple-media
IntroductionSupport for the Apple Media Service which provides media playback info and control.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-apple-mediaTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-apple-mediaTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-apple-mediaUsage Exampleimportadafruit_blefromadafruit_ble.advertising.standardimportSolicitServicesAdvertisementfromadafruit_ble_apple_mediaimportAppleMediaServiceradio=adafruit_ble.BLERadio()a=SolicitServicesAdvertisement()a.solicited_services.append(AppleMediaService)radio.start_advertising(a)whilenotradio.connected:passprint("connected")known_notifications=set()i=0whileradio.connected:forconnectioninradio.connections:ifnotconnection.paired:connection.pair()print("paired")ams=connection[AppleMediaService]print("App:",ams.player_name)print("Title:",ams.title)print("Album:",ams.album)print("Artist:",ams.artist)ifams.playing:print("Playing")elifams.paused:print("Paused")ifi>3:ams.toggle_play_pause()i=0print()time.sleep(3)i+=1print("disconnected")DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-apple-notification-center
IntroductionBLE library for the Apple Notification CenterDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-apple-notification-centerTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-apple-notification-centerTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-apple-notification-centerUsage ExampleDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-beacon
IntroductionBLE Location Beacon for CircuitPythonDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Purchase one from the Adafruit shopInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-beaconTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-beaconTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.env/bin/activatepip3installadafruit-circuitpython-ble-beaconInstalling to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstalladafruit_ble_beaconOr the following command to update an existing version:circupupdateUsage ExampleSee theexamples/folder for more usage examples.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-berrymed-pulse-oximeter
IntroductionBLE support for BerryMed Pulse OximetersDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-berrymed-pulse-oximeterTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-berrymed-pulse-oximeterTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-berrymed-pulse-oximeterDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-broadcastnet
IntroductionBasic IOT over BLE advertisements.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteOnly the bridge examples work on Raspberry Pi because Blinka_bleiodoesn’t support advertising, only scanning.On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-broadcastnetTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-broadcastnetTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-broadcastnetUsage ExampleAdd a secrets.py file and then runble_broadcastnet_blinka_bridge.py.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-creation
IntroductionFriendlier device discovery using Creation IDsDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircupPurchase one from the Adafruit shopInstalling from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-creationTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-creationTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-creationUsage ExampleSee examples in the directory.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.DocumentationFor information on building library documentation, please check outthis guide.
adafruit-circuitpython-ble-cycling-speed-and-cadence
IntroductionBLE Cycling Speed and Cadence ServiceDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-cycling-speed-and-cadenceTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-cycling-speed-and-cadenceTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-cycling-speed-and-cadenceDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-eddystone
IntroductionCircuitPython BLE library for Google’s open “physical web” Eddystone.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-eddystoneTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-eddystoneTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-eddystoneUsage Example"""This example broadcasts our Mac Address as our Eddystone ID and a link to the Adafruit Discord server."""importtimeimportadafruit_blefromadafruit_ble_eddystoneimportuid,urlradio=adafruit_ble.BLERadio()# Reuse the BLE address as our Eddystone instance id.eddystone_uid=uid.EddystoneUID(radio.address_bytes)eddystone_url=url.EddystoneURL("https://adafru.it/discord")whileTrue:# Alternate between advertising our ID and our URL.radio.start_advertising(eddystone_uid)time.sleep(0.5)radio.stop_advertising()radio.start_advertising(eddystone_url)time.sleep(0.5)radio.stop_advertising()time.sleep(4)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-file-transfer
IntroductionSimple BLE Service for reading and writing files over BLE. This BLE service is geared towards file transfer to and from a device running the service. A core part of the protocol is free space responses so that the server can be a memory limited device. The free space responses allow for small buffer sizes that won’t be overwhelmed by the client.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-file-transferTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-file-transferTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-file-transferUsage ExamplesSeeexamples/ble_file_transfer_simpletest.pyfor a client example. A stub server implementation is inexamples/ble_file_transfer_stub_server.py.ProtocolThe file transfer protocol is meant to be simple and easy to implement. It uses free space counts as a way to rate limit file content data transfer. All multi-byte numbers are encoded with the least significant byte first (“<” in CPython’s struct module).GATT ServiceThe UUID of the service is0xfebb, Adafruit’s 16-bit service UUID.The base UUID used in characteristics isADAFxxxx-4669-6C65-5472-616E73666572. The 16-bit numbers below are substituted into thexxxxportion.The service has two characteristics:version (0x0100) - Simple unsigned 32-bit integer version number. May be 1 - 4.raw transfer (0x0200) - Bidirectional link with a custom protocol. The client does WRITE_NO_RESPONSE to the characteristic and then server replies via NOTIFY. (This is similar to the Nordic UART Service but on a single characteristic rather than two.) The commands over the transfer characteristic are idempotent and stateless. A disconnect during a command will reset the state.Time resolutionTime resolution varies based filesystem type. FATFS can only get down to the 2 second bound after 1980. Littlefs can do 64-bit nanoseconds after January 1st, 1970.To account for this, the protocol has time in 64-bit nanoseconds after January 1st, 1970. However, the server will respond with a potentially truncated version that is the value stored.Also note that devices serving the file transfer protocol may not have it’s own clock so do not rely on time ordering. Any internal writes may set the time incorrectly. So, we only recommend using the value as a cache key.CommandsCommands always start with a fixed header. The first entry is always the command number itself encoded in a single byte. The number of subsequent entries in the header will vary by command. The entire header must be sent as a unit so set the characteristic with the full header packet. You can combine multiple commands into a single write as long as the complete header is in the packet.Paths use/as a separator and full paths must start with/.All numbers are unsigned.All values are aligned with respect to the start of the packet.Status bytes are0x01for OK and0x02for error. Values other than0x01are errors.0x00should not be used for a specific error but still considered an error.0x05is an error for trying to modify a read-only filesystem.0x10- Read a fileGiven a full path, returns the full contents of the file.The header is four fixed entries and a variable length path:Command: Single byte. Always0x10.1 Byte reserved for padding.Path length: 16-bit number encoding the encoded length of the path string.Chunk offset: 32-bit number encoding the offset into the file to start the first chunk.Chunk size: 32-bit number encoding the amount of data that the client can handle in the first reply.Path: UTF-8 encoded string that isnotnull terminated. (We send the length instead.)The server will respond with:Command: Single byte. Always0x11.Status: Single byte.2 Bytes reserved for padding.Chunk offset: 32-bit number encoding the offset into the file of this chunk.Total length: 32-bit number encoding the total file length.Chunk length: 32-bit number encoding the length of the read data up to the chunk size provided in the header.Chunk-length contents of the file starting from the current position.If the chunk length is smaller than the total length, then the client will request more data by sending:Command: Single byte. Always0x12.Status: Single byte. Always OK for now.2 Bytes reserved for padding.Chunk offset: 32-bit number encoding the offset into the file to start the next chunk.Chunk size: 32-bit number encoding the number of bytes to read. May be different than the original size. Does not need to be limited by the total size.The transaction is complete after the server has replied with all data. (No acknowledgement needed from the client.)0x20- Write a fileWrites the content to the given full path. If the file exists, it will be overwritten. Content may be written as received so an interrupted transfer may lead to a truncated file.Offset larger than the existing file size will introduce zeros into the gap.The header is four fixed entries and a variable length path:Command: Single byte. Always0x20.1 Byte reserved for padding.Path length: 16-bit number encoding the encoded length of the path string.Offset: 32-bit number encoding the starting offset to write.Current time: 64-bit number encoding nanoseconds since January 1st, 1970. Used as the file modification time. Not all system will support the full resolution. Use the truncated time response value for caching.Total size: 32-bit number encoding the total length of the file contents.Path: UTF-8 encoded string that isnotnull terminated. (We send the length instead.)The server will repeatedly respond until the total length has been transferred with:Command: Single byte. Always0x21.Status: Single byte.0x01if OK.0x05if the filesystem is read-only.0x02if any parent directory is missing or a file.2 Bytes reserved for padding.Offset: 32-bit number encoding the starting offset to write. (Should match the offset from the previous 0x20 or 0x22 message)Truncated time: 64-bit number encoding nanoseconds since January 1st, 1970 as stored by the file system. The resolution may be less that the protocol. It is sent back for use in caching on the host side.Free space: 32-bit number encoding the amount of data the client can send.The client will repeatedly respond until the total length has been transferred with:Command: Single byte. Always0x22.Status: Single byte. Always0x01for OK.2 Bytes reserved for padding.Offset: 32-bit number encoding the offset to write.Data size: 32-bit number encoding the amount of data the client is sending.DataThe transaction is complete after the server has received all data and replied with a status with 0 free space and offset set to the content length.NOTE: Current time was added in version 3. The rest of the packets remained the same.0x30- Delete a file or directoryDeletes the file or directory at the given full path. Non-empty directories will have their contents deleted as well.The header is two fixed entries and a variable length path:Command: Single byte. Always0x30.1 Byte reserved for padding.Path length: 16-bit number encoding the encoded length of the path string.Path: UTF-8 encoded string that isnotnull terminated. (We send the length instead.)The server will reply with:Command: Single byte. Always0x31.Status: Single byte.0x01if the file or directory was deleted,0x05if the filesystem is read-only or0x02if the path is non-existent.NOTE: In version 2, this command now deletes contents of a directory as well. It won’t error.0x40- Make a directoryCreates a new directory at the given full path. If a parent directory does not exist, then it will also be created. If any name conflicts with an existing file, an error will be returned.The header is two fixed entries and a variable length path:Command: Single byte. Always0x40.1 Byte reserved for padding.Path length: 16-bit number encoding the encoded length of the path string.4 Bytes reserved for padding.Current time: 64-bit number encoding nanoseconds since January 1st, 1970. Used as the file modification time. Not all system will support the full resolution. Use the truncated time response value for caching.Path: UTF-8 encoded string that isnotnull terminated. (We send the length instead.)The server will reply with:Command: Single byte. Always0x41.Status: Single byte.0x01if the directory(s) were created,0x05if the filesystem is read-only or0x02if any parent of the path is an existing file.6 Bytes reserved for padding.Truncated time: 64-bit number encoding nanoseconds since January 1st, 1970 as stored by the file system. The resolution may be less that the protocol. It is sent back for use in caching on the host side.0x50- List a directoryLists all of the contents in a directory given a full path. Returned paths arerelativeto the given path to reduce duplication.The header is two fixed entries and a variable length path:Command: Single byte. Always0x50.1 Byte reserved for padding.Path length: 16-bit number encoding the encoded length of the path string.Path: UTF-8 encoded string that isnotnull terminated. (We send the length instead.)The server will reply with n+1 entries for a directory with n files:Command: Single byte. Always0x51.Status: Single byte.0x01if the directory exists or0x02if it doesn’t.Path length: 16-bit number encoding the encoded length of the path string.Entry number: 32-bit number encoding the entry number.Total entries: 32-bit number encoding the total number of entries.Flags: 32-bit number encoding data about the entries.Bit 0: Set when the entry is a directoryBits 1-7: ReservedModification time: 64-bit number of nanoseconds since January 1st, 1970.However, files modifiers may not have an accurate clock so donotassume it is correct. Instead, only use it to determine cacheability vs a local copy.File size: 32-bit number encoding the size of the file. Ignore for directories. Value may change.Path: UTF-8 encoded string that isnotnull terminated. (We send the length instead.) These paths are relative so they won’t contain/at all.The transaction is complete when the final entry is sent from the server. It will have entry number == total entries and zeros for flags, file size and path length.0x60- Move a file or directoryMoves a file or directory at a given path to a different path. Can be used to rename as well. The two paths are sent separated by a byte so that the server may null-terminate the string itself. The client may send anything there.The header is two fixed entries and a variable length path:Command: Single byte. Always0x60.1 Byte reserved for padding.Old Path length: 16-bit number encoding the encoded length of the path string.New Path length: 16-bit number encoding the encoded length of the path string.Old Path: UTF-8 encoded string that isnotnull terminated. (We send the length instead.)One padding byte. This can be used to null terminate the old path string.New Path: UTF-8 encoded string that isnotnull terminated. (We send the length instead.)The server will reply with:Command: Single byte. Always0x61.Status: Single byte.0x01on success,0x05if read-only, or0x02on other error.NOTE: This is added in version 4.VersionsVersion 2Changes delete to delete contents of non-empty directories automatically.Version 3Adds modification time. * Adds current time to file write command. * Adds current time to make directory command. * Adds modification time to directory listing entries.Version 4Adds move command.Adds 0x05 error for read-only filesystems. This is commonly that USB is editing the same filesystem.Removes requirement that directory paths end with /.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.DocumentationFor information on building library documentation, please check outthis guide.
adafruit-circuitpython-ble-heart-rate
IntroductionBLE Heart Rate ServiceDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-heart-rateTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-heart-rateTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-heart-rateDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-ibbq
IntroductionBLE support for iBBQ thermometersDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-ibbqTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-ibbqTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-ibbqDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-lywsd03mmc
IntroductionBLE Support for Xiaomi LYWSD03MMC Thermometer/HygrometerDependenciesThis driver depends on:Adafruit CircuitPythonadafruit_blePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-lywsd03mmcTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-lywsd03mmcTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-lywsd03mmcDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-magic-light
IntroductionBLE service for Magic Light BLE RGB bulbs. Available from Amazonhere.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-magic-lightTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-magic-lightTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-magic-lightUsage Example"""This demo connects to a magic light and has it do a colorwheel."""importadafruit_bleimport_bleiofromadafruit_ble.advertising.standardimportProvideServicesAdvertisementfromadafruit_ble_magic_lightimportMagicLightService# CircuitPython <6 uses its own ConnectionError type. So, is it if available. Otherwise,# the built in ConnectionError is used.connection_error=ConnectionErrorifhasattr(_bleio,"ConnectionError"):connection_error=_bleio.ConnectionErrordeffind_connection():forconnectioninradio.connections:ifMagicLightServicenotinconnection:continuereturnconnection,connection[MagicLightService]returnNone,None# Start advertising before messing with the display so that we can connect immediately.radio=adafruit_ble.BLERadio()active_connection,pixels=find_connection()current_notification=Noneapp_icon_file=NonewhileTrue:ifnotactive_connection:print("Scanning for Magic Light")forscaninradio.start_scan(ProvideServicesAdvertisement):ifMagicLightServiceinscan.services:active_connection=radio.connect(scan)try:pixels=active_connection[MagicLightService]exceptconnection_error:print("disconnected")continuebreakradio.stop_scan()i=0whileactive_connection.connected:pixels[0]=colorwheel(i%256)i+=1active_connection=NoneDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-midi
IntroductionBLE MIDI service for CircuitPythonDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-midiTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-midiTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ble-midiUsage Example""" This example sends MIDI out. It sends NoteOn and then NoteOff with a random pitch bend. """importtimeimportrandomimportadafruit_blefromadafruit_ble.advertising.standardimportProvideServicesAdvertisementimportadafruit_ble_midiimportadafruit_midifromadafruit_midi.control_changeimportControlChangefromadafruit_midi.note_offimportNoteOfffromadafruit_midi.note_onimportNoteOnfromadafruit_midi.pitch_bendimportPitchBend# Use default HID descriptormidi_service=adafruit_ble_midi.MIDIService()advertisement=ProvideServicesAdvertisement(midi_service)# advertisement.appearance = 961ble=adafruit_ble.BLERadio()ifble.connected:forcinble.connections:c.disconnect()midi=adafruit_midi.MIDI(midi_out=midi_service,out_channel=0)print("advertising")ble.start_advertising(advertisement)whileTrue:print("Waiting for connection")whilenotble.connected:passprint("Connected")whileble.connected:midi.send(NoteOn(44,120))# G sharp 2nd octavetime.sleep(0.25)a_pitch_bend=PitchBend(random.randint(0,16383))midi.send(a_pitch_bend)time.sleep(0.25)# note how a list of messages can be usedmidi.send([NoteOff("G#2",120),ControlChange(3,44)])time.sleep(0.5)print("Disconnected")print()ble.start_advertising(advertisement)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ble-pulse-oximeter
IntroductionBLE support for BerryMed Pulse OximetersDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ble-berrymed-pulse-oximeterTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ble-berrymed-pulse-oximeterTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.envsource.env/bin/activatepip3installadafruit-circuitpython-ble-berrymed-pulse-oximeterContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.DocumentationFor information on building library documentation, please check outthis guide.
adafruit-circuitpython-ble-radio
IntroductionThis library provides simple byte and string based inter-device communication via BLE.It works like a walkie-talkie: configure your device to use a certain channel (numbered 0-255, default being 42) and it will broadcast on that channel and receive any messages from other devices using that channel.DependenciesThis library depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Usage ExampleAll the functionality is exposed via the very simpleRadioclass:from adafruit_ble_radio import Radio # A radio instance listens/broadcasts on a numbered channel. r = Radio(channel=7) # Update radio instance settings. r.configure(channel=9) # Broadcast a simple string message. r.send("Hello") # Broadcast raw bytes. r.send_bytes(b"Hello") # A loop to listen for incoming string based messages... while True: msg = r.receive() if msg: print(msg) # Alternatively, to get the raw bytes and other details... while True: msg = r.receive_full() if msg: msg_bytes = msg[0] msg_strength = msg[1] msg_time = msg[2] print("Recieved {} (strength {}, at time {})".format( msg_bytes, msg_strength, msg_time))Unit TestsTo run the test suite you should havepytestandpytest-coverageinstalled (pip install pytestpytest-coverage).Run the unit tests with the following command:$ pytest --cov-report term-missing --cov=adafruit_ble_radio tests/DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bluefruitconnect
IntroductionThis module helps you to communicate with the Adafruit Bluefruit Connect app or use its protocols.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bluefruitconnectTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bluefruitconnectTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bluefruitconnectUsage ExampleNormally this library is used with theAdafruit_CircuitPython_BluefruitConnectlibrary (adafruit_bluefruit_connect). The included examples use that library. Below is a simple standalone example.fromadafruit_bluefruit_connect.color_packetimportColorPacketfromadafruit_bluefruit_connect.gyro_packetimportGyroPacket# [uart setup omitted]color_packet=ColorPacket((70,75,80))gyro_packet=GyroPacket.from_bytes(packet_buf)uart.write(gyro_packet.to_bytes())DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bluefruitspi
IntroductionHelper class to work with the Adafruit Bluefruit LE SPI Friend.DependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bluefruitspiTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bluefruitspiTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bluefruitspiUsage Example# A simple echo test for the Feather M0 Bluefruit# Sets the name, then echo's all RX'd data with a reversed packetimporttimeimportbusioimportboardfromdigitalioimportDigitalInOutfromadafruit_bluefruitspiimportBluefruitSPIspi_bus=busio.SPI(board.SCK,MOSI=board.MOSI,MISO=board.MISO)cs=DigitalInOut(board.D8)irq=DigitalInOut(board.D7)rst=DigitalInOut(board.D4)bluefruit=BluefruitSPI(spi_bus,cs,irq,rst,debug=False)# Initialize the device and perform a factory resetprint("Initializing the Bluefruit LE SPI Friend module")bluefruit.init()bluefruit.command_check_OK(b'AT+FACTORYRESET',delay=1)# Print the response to 'ATI' (info request) as a stringprint(str(bluefruit.command_check_OK(b'ATI'),'utf-8'))# Change advertised namebluefruit.command_check_OK(b'AT+GAPDEVNAME=BlinkaBLE')whileTrue:print("Waiting for a connection to Bluefruit LE Connect ...")# Wait for a connection ...dotcount=0whilenotbluefruit.connected:print(".",end="")dotcount=(dotcount+1)%80ifdotcount==79:print("")time.sleep(0.5)# Once connected, check for incoming BLE UART dataprint("\n*Connected!*")connection_timestamp=time.monotonic()whileTrue:# Check our connection status every 3 secondsiftime.monotonic()-connection_timestamp>3:connection_timestamp=time.monotonic()ifnotbluefruit.connected:break# OK we're still connected, see if we have any data waitingresp=bluefruit.uart_rx()ifnotresp:continue# nothin'print("Read%dbytes:%s"%(len(resp),resp))# Now write it!print("Writing reverse...")send=[]foriinrange(len(resp),0,-1):send.append(resp[i-1])print(bytes(send))bluefruit.uart_tx(bytes(send))print("Connection lost.")DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bme280
IntroductionI2C and SPI driver for the Bosch BME280 Temperature, Humidity, and Barometric Pressure sensorInstallation and DependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure that the driver and all dependencies are available on the CircuitPython filesystem. This can be most easily achieved by downloading and installing the latestAdafruit library and driver bundleon your device.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bme280To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bme280To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bme280Installing to a connected CircuitPython DeviceSome devices, eg. the QT-PY, are very limited in memory. The BME280 library contains two variants - basic and advanced - which give different levels of functionality.Installing the BME280 library could have the following outcomes:It installs successfully and your code runs successfully. Woo-hoo! Continue with your amazing project.It installs successfully and your code fails to run with a memory allocation error. Try one of the following:If yourcode.pyis large, especially if it has lots of comments, you can shrink it into a.mpyfile instead. See the AdafruitLearn Guideon shrinking your code.Only use the basic BME280 implementation, and remove the following file:<CIRCUITPY>/lib/adafruit_bme280/advanced.mpywhere <CIRCUITPY> is the mounted location of your device. Make sure that your code only uses the basic implementation.Usage Exampleimportboardimporttimefromadafruit_bme280importbasicasadafruit_bme280# Create sensor object, using the board's default I2C bus.i2c=board.I2C()# uses board.SCL and board.SDAbme280=adafruit_bme280.Adafruit_BME280_I2C(i2c)# change this to match the location's pressure (hPa) at sea levelbme280.sea_level_pressure=1013.25whileTrue:print("\nTemperature:%0.1fC"%bme280.temperature)print("Humidity:%0.1f%%"%bme280.relative_humidity)print("Pressure:%0.1fhPa"%bme280.pressure)print("Altitude =%0.2fmeters"%bme280.altitude)time.sleep(2)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bme680
IntroductionCircuitPython driver for BME680 sensor over I2CDependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bme680To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bme680To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bme680Usage Exampleimportadafruit_bme680importtimeimportboard# Create sensor object, communicating over the board's default I2C busi2c=board.I2C()# uses board.SCL and board.SDAbme680=adafruit_bme680.Adafruit_BME680_I2C(i2c)# change this to match the location's pressure (hPa) at sea levelbme680.sea_level_pressure=1013.25whileTrue:print("\nTemperature:%0.1fC"%bme680.temperature)print("Gas:%dohm"%bme680.gas)print("Humidity:%0.1f%%"%bme680.relative_humidity)print("Pressure:%0.3fhPa"%bme680.pressure)print("Altitude =%0.2fmeters"%bme680.altitude)time.sleep(2)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bmp280
IntroductionCircuitPython driver from BMP280 Temperature and Barometic Pressure sensorInstallation and DependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driverfrom PyPI. To install for the current user:pip3installadafruit-circuitpython-bmp280To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bmp280To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bmp280Usage Exampleimporttimeimportboard# import digitalio # For use with SPIimportadafruit_bmp280# Create sensor object, communicating over the board's default I2C busi2c=board.I2C()# uses board.SCL and board.SDAbmp280=adafruit_bmp280.Adafruit_BMP280_I2C(i2c)# OR Create sensor object, communicating over the board's default SPI bus# spi = board.SPI()# bmp_cs = digitalio.DigitalInOut(board.D10)# bmp280 = adafruit_bmp280.Adafruit_BMP280_SPI(spi, bmp_cs)# change this to match the location's pressure (hPa) at sea levelbmp280.sea_level_pressure=1013.25whileTrue:print("\nTemperature:%0.1fC"%bmp280.temperature)print("Pressure:%0.1fhPa"%bmp280.pressure)print("Altitude =%0.2fmeters"%bmp280.altitude)time.sleep(2)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bmp3xx
IntroductionCircuitPython driver from BMP3XX Temperature and Barometric Pressure sensor.DependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bmp3xxTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bmp3xxTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bmp3xxUsage ExampleSee usage examples in the examples folder.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bno055
IntroductionDependenciesThis driver depends on theRegisterandBus Devicelibraries. Please ensure they are also available on the CircuitPython filesystem. This is easily achieved by downloadinga library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bno055To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bno055To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bno055Usage NotesOf course, you must import the library to use it:importadafruit_bno055This driver takes an instantiated and active I2C object as an argument to its constructor. The way to create an I2C object depends on the board you are using. For boards with labeled SCL and SDA pins, you can:importboardi2c=board.I2C()Once you have the I2C object, you can create the sensor object:sensor=adafruit_bno055.BNO055_I2C(i2c)And then you can start reading the measurements:print(sensor.temperature)print(sensor.euler)print(sensor.gravity)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bno08x
IntroductionHelper library for the Hillcrest Laboratories BNO08x IMUsDependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bno08xTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bno08xTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bno08xUsage Exampleimportboardimportbusiofromadafruit_bno08x.i2cimportBNO08X_I2Cfromadafruit_bno08ximportBNO_REPORT_ACCELEROMETERi2c=busio.I2C(board.SCL,board.SDA)bno=BNO08X_I2C(i2c)bno.enable_feature(BNO_REPORT_ACCELEROMETER)whileTrue:accel_x,accel_y,accel_z=bno.acceleration# pylint:disable=no-memberprint("X:%0.6fY:%0.6fZ:%0.6fm/s^2"%(accel_x,accel_y,accel_z))DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-bno08x-rvc
IntroductionA simple helper library for using the UART-RVC mode of the BNO08x IMUsDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-bno08x-rvcTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-bno08x-rvcTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-bno08x-rvcUsage Exampleimporttimeimportboardimportbusiofromadafruit_bno08x_rvcimportBNO08x_RVCuart=busio.UART(board.TX,board.RX,baudrate=115200,receiver_buffer_size=2048)rvc=BNO08x_RVC(uart)whileTrue:roll,pitch,yaw,x_accel,y_accel,z_accel=rvc.headingprint("Roll:%2.2fPitch:%2.2fYaw:%2.2fDegrees"%(roll,pitch,yaw))print("Acceleration X:%2.2fY:%2.2fZ:%2.2fm/s^2"%(x_accel,y_accel,z_accel))print("")time.sleep(0.1)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-boardtest
IntroductionBoard test suite for CircuitPython. Run these tests to ensure that a CircuitPython port was created correctly, individual pin mappings are correct, and buses (e.g. SPI) work.Tests can be run individually. Copy code found in eachboardtest_<name>.pymodule to your CIRCUITPYTHON device drive, and rename the filecode.py.Alternatively, tests can be imported as modules. Copy the desired test file to CIRCUITPYTHON device drive and import the test in your own code. Each test can be run with therun_test(pins)function.Theboardtest_simpletest.py(inexamples/) shows how to call tests from within a script.boardtest_simpletest.pyruns the following tests:LED TestGPIO TestVoltage Monitor TestUART TestSPI TestI2C TestDependenciesThis test suite depends on:Adafruit CircuitPythonBus DeviceSD CardPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Usage ExampleYou will need the following components:Multimeter1xLED1x 330 Ohm resistor or220 Ohm resistor2x4.7k Ohm resistorMicrochip 25AA040A SPI EEPROMMicrochip AT24HC04B I2C EEPROMBreadboardWiresConnect the components as shown to your board. Note that you can use a 220 Ohm or 330 Ohm resistor for the LED.To use each test, copy the individual .py or .mpy test(s) into a folder named adafruit_boardtest in the CIRCUITPY drive, import the library, find the pins available on your board, and callboardtest_<testname>.run_test(pins). To run the GPIO test, for example:importboardfromadafruit_boardtestimportboardtest_gpio# List out all the pins available to uspins=[pforpindir(board)]print()print("All pins found:",end=' ')# Print pinsforpinpins:print(p,end=' ')print('\n')# Run testresult=run_test(pins)print()print(result[0])print("Pins tested: "+str(result[1]))DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-busdevice
Adafruit CircuitPython BusDeviceTheI2CDeviceandSPIDevicehelper classes make managing transaction state on a bus easy. For example, they manage locking the bus to prevent other concurrent access. For SPI devices, it manages the chip select and protocol changes such as mode. For I2C, it manages the device address.NoteOn microcontroller boards using CircuitPython v6.3.0 or newer, the firmware may already have theadafruit_bus_devicepackage builtin, thus there may be no need to add this package to your CIRCUITPY drive’s “lib” directory. If both the builtin and add-onadafruit_bus_devicepackages are present, then some libraries that require this packagemighthave problems importing it.Please check theCircuitPython documentation’s “module support matrix”to make sure that your board’s firmware does include the builtinadafruit_bus_devicepackage.On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-busdeviceTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-busdeviceTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-busdeviceUsage ExampleSee examples/read_register_i2c.py and examples/read_register_spi.py for examples of the module’s usage.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-cap1188
IntroductionCircuitPython driver for the CAP1188 8-Key Capacitive Touch Sensor Breakout.DependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-cap1188To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-cap1188To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-cap1188Usage ExampleSee usage examples in the examples folder.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ccs811
Adafruit CircuitPython CCS811 LibraryCircuitPython driver for theCCS811 air quality sensor.DependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ccs811To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ccs811To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ccs811Usage NotesSeethe guidefor wiring and installation instructions.Of course, you must import the library to use it:importbusioimportadafruit_ccs811Next, initialize the I2C bus object.fromboardimport*i2c=board.I2C()# uses board.SCL and board.SDAOnce you have created the I2C interface object, you can use it to instantiate the CCS811 objectccs=adafruit_ccs811.CCS811(i2c)Reading SensorTo read the gas sensor simply read the attributes:print("CO2: ",ccs.eco2," TVOC:",ccs.tvoc)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-charlcd
IntroductionThis library is compatible with standard Character LCDs such as:Adafruit Standard LCD 16x2Adafruit RGB backlight negative LCD 16x2Adafruit RGB backlight negative LCD 20x4Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-charlcdTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-charlcdTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-charlcdDependenciesThis driver depends on:Adafruit CircuitPythonAdafruit CircuitPython BusDeviceAdafruit CircuitPython MCP230xxAdafruit CircuitPython 74HC595I2C & SPI displays also depend on:Bus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading theAdafruit library and driver bundle.Usage ExampleTheCharacter_LCDclass interfaces a predefined Character LCD display with CircuitPython.importboardimportdigitalioimportadafruit_character_lcd.character_lcdascharacter_lcdYou must define the data pins (RS,EN,D4,D5,D6,D7) in your code before using theCharacter_LCDclass. If you want to have on/offbacklightfunctionality, you can also define your backlight aslcd_backlight. Otherwise, the backlight will always remain on. The following is an example setup.lcd_rs=digitalio.DigitalInOut(board.D7)lcd_en=digitalio.DigitalInOut(board.D8)lcd_d7=digitalio.DigitalInOut(board.D12)lcd_d6=digitalio.DigitalInOut(board.D11)lcd_d5=digitalio.DigitalInOut(board.D10)lcd_d4=digitalio.DigitalInOut(board.D9)lcd_backlight=digitalio.DigitalInOut(board.D13)You must also define the size of the CharLCD by specifying itslcd_columnsandlcd_rows:lcd_columns=16lcd_rows=2After you have set up your LCD, we can make the device by calling itlcd=character_lcd.Character_LCD_Mono(lcd_rs,lcd_en,lcd_d4,lcd_d5,lcd_d6,lcd_d7,lcd_columns,lcd_rows,lcd_backlight)To verify that your pins are correct, print a hello message to the CharLCD:lcd.message="Hello\nCircuitPython"Custom character example withcreate_char()is provided within /examples/DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-circuitplayground
IntroductionThis high level library provides objects that represent Circuit Playground Express and Bluefruit hardware.InstallationFor Circuit Playground Express, simply install CircuitPython to use this library - the library itself and all of its dependencies are built into CircuitPython for Circuit Playground Express.For Circuit Playground Bluefruit, you must install this library and all of its dependencies. Please downloadthe latest Adafruit CircuitPython library bundle. Open the resulting zip file, open the lib folder within, and copy the following folders and files to the lib folder on your CIRCUITPY drive:adafruit_bus_device/adafruit_circuitplayground/adafruit_lis3dh.mpyadafruit_thermistor.mpyneopixel.mpyUsage ExampleUsing this library is super simple. Simply import thecpvariable from the module and then use it.fromadafruit_circuitplaygroundimportcpwhileTrue:ifcp.button_a:print("Temperature:",cp.temperature)cp.red_led=cp.button_bTo learn more about all the features of this library, check out theCircuitPython Made Easy on Circuit Playground Express and Bluefruit guideon the Adafruit Learn System.Circuit Playground Library DetailsFor a detailed explanation of how the Circuit Playground library functions, seeThe Technical Side pageof the CircuitPython Made Easy on Circuit Playground Express and Bluefruit guide.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-clue
IntroductionA high level library representing all the features of the Adafruit CLUEDependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterAdafruit LSM6DSAdafruit LIS3MDLAdafruit APDS9960Adafruit BMP280Adafruit SHT31DAdafruit NeoPixelAdafruit Display TextPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Demos may require libraries not listed here.Usage ExampleThis example displays sensor and input data on the CLUE display.fromadafruit_clueimportclueclue.sea_level_pressure=1020clue_data=clue.simple_text_display(title="CLUE Sensor Data!",title_scale=2,num_lines=15)whileTrue:clue_data[0].text="Acceleration:{:.2f}{:.2f}{:.2f}".format(*clue.acceleration)clue_data[1].text="Gyro:{:.2f}{:.2f}{:.2f}".format(*clue.gyro)clue_data[2].text="Magnetic:{:.3f}{:.3f}{:.3f}".format(*clue.magnetic)clue_data[3].text="Pressure:{:.3f}hPa".format(clue.pressure)clue_data[4].text="Altitude:{:.1f}m".format(clue.altitude)clue_data[5].text="Temperature:{:.1f}C".format(clue.temperature)clue_data[6].text="Humidity:{:.1f}%".format(clue.humidity)clue_data[7].text="Proximity:{}".format(clue.proximity)clue_data[8].text="Gesture:{}".format(clue.gesture)clue_data[9].text="Color: R:{}G:{}B:{}C:{}".format(*clue.color)clue_data[10].text="Button A:{}".format(clue.button_a)clue_data[11].text="Button B:{}".format(clue.button_b)clue_data[12].text="Touch 0:{}".format(clue.touch_0)clue_data[13].text="Touch 1:{}".format(clue.touch_1)clue_data[14].text="Touch 2:{}".format(clue.touch_2)clue_data.show()DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-colorsys
IntroductionCPython module Colorsys made available for CircuitPython.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Usage ExampleSee example in docs/examples.rst.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-connectionmanager
IntroductionA urllib3.poolmanager/urllib3.connectionpool-like library for managing sockets and connectionsDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Purchase one from the Adafruit shopInstalling from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-connectionmanagerTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-connectionmanagerTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.env/bin/activatepip3installadafruit-circuitpython-connectionmanagerInstalling to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstalladafruit_connectionmanagerOr the following command to update an existing version:circupupdateUsage ExampleThis library is used internally by libraries likeAdafruit_CircuitPython_RequestsandAdafruit_CircuitPython_MiniMQTTUsage examples are within theexamplessubfolder of this library.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-crickit
IntroductionThis convenience library makes coding for the Crickit robotics boards simpler and shorter.DependenciesThis driver depends on:Adafruit seesaw libraryAdafruit Motor libraryPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-crickitTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-crickitTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-crickitUsage ExampleThis examples shows how to control all the devices supported by the library. In most cases you just need a couple of imports.# This is a mock example showing typical usage of the library for each kind of device.fromadafruit_crickitimportcrickit# Add this import if using stepper motors.# It will expose constants saying how to step: stepper.FORWARD, stepper.BACKWARD, etc.fromadafruit_motorimportstepper# Set servo 1 to 90 degreescrickit.servo_1.angle=90# Change servo settings.crickit.servo_1.actuation_range=135crickit.servo_1.set_pulse_width_range(min_pulse=850,max_pulse=2100)# You can assign a device to a variable to get a shorter name.servo_2=crickit.servo_2servo_2.throttle=0# Run a continous servo on Servo 2 backwards at half speed.crickit.continuous_servo_2.throttle=-0.5# Run the motor on Motor 1 terminals at half speed.crickit.dc_motor_1.throttle=0.5# Set Drive 1 terminal to 3/4 strength.crickit.drive_1.fraction=0.75ifcrickit.touch_1.value:print("Touched terminal Touch 1")# A single stepper motor uses up all the motor terminals.crickit.stepper_motor.onestep(direction=stepper.FORWARD)# You can also use the Drive terminals for a stepper motorcrickit.drive_stepper_motor.onestep(direction=stepper.BACKWARD)# Note: On CPX Crickit, NeoPixel pin is normally connected to A1, not to seesaw,# so this part of the demo cannot control the NeoPixel terminal.# Strip or ring of 8 NeoPixelscrickit.init_neopixel(8)crickit.neopixel.fill((100,100,100))# Set the Crickit's on-board NeoPixel to a dim purple.crickit.onboard_pixel.brightness=0.01crickit.onboard_pixel[0]=(255,24,255)# orcrickit.onboard_pixel.fill((255,24,255))DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-cst8xx
IntroductionCST8xx capacitive touch driver for CircuitPythonDependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Round RGB 666 TTL TFT Display - 2.1” 480x480 - Capacitive Touch - TL021WVC02CT-B1323Purchase one from the Adafruit shopInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-cst8xxTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-cst8xxTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.env/bin/activatepip3installadafruit-circuitpython-cst8xxInstalling to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstalladafruit_cst8xxOr the following command to update an existing version:circupupdateUsage Exampleimportboardimportadafruit_cst8xxctp=adafruit_cst8xx.Adafruit_CST8XX(board.I2C())events=adafruit_cst8xx.EVENTSwhileTrue:ifctp.touched:fortouch_id,touchinenumerate(ctp.touches):x=touch["x"]y=touch["y"]event=events[touch["event_id"]]print(f"touch_id:{touch_id}, x:{x}, y:{y}, event:{event}")DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-cursorcontrol
IntroductionMouse cursor for interaction with CircuitPython UI elements such asbuttons.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-cursorcontrolTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-cursorcontrolTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-cursorcontrolUsage ExampleSee examples in examples/ folder.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-dash-display
IntroductionCircuitPython library for creating Adafruit IO dashboards.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Usage ExampleimporttimeimportsslimportboardfromdigitalioimportDigitalInOut,Direction,Pullimporttouchioimportsocketpoolimportwifiimportadafruit_minimqtt.adafruit_minimqttasMQTTfromadafruit_io.adafruit_ioimportIO_MQTTfromadafruit_dash_displayimportHubup=DigitalInOut(board.BUTTON_UP)up.direction=Direction.INPUTup.pull=Pull.DOWNselect=DigitalInOut(board.BUTTON_SELECT)select.direction=Direction.INPUTselect.pull=Pull.DOWNdown=DigitalInOut(board.BUTTON_DOWN)down.direction=Direction.INPUTdown.pull=Pull.DOWNback=touchio.TouchIn(board.CAP7)submit=touchio.TouchIn(board.CAP8)try:fromsecretsimportsecretsexceptImportError:print("WiFi secrets are kept in secrets.py, please add them there!")raisedisplay=board.DISPLAY# Set your Adafruit IO Username and Key in secrets.py# (visit io.adafruit.com if you need to create an account,# or if you need your Adafruit IO key.)aio_username=secrets["aio_username"]aio_key=secrets["aio_key"]print("Connecting to%s"%secrets["ssid"])wifi.radio.connect(secrets["ssid"],secrets["password"])print("Connected to%s!"%secrets["ssid"])# Create a socket poolpool=socketpool.SocketPool(wifi.radio)# Initialize a new MQTT Client objectmqtt_client=MQTT.MQTT(broker="io.adafruit.com",username=secrets["aio_username"],password=secrets["aio_key"],socket_pool=pool,ssl_context=ssl.create_default_context(),)# Initialize an Adafruit IO MQTT Clientio=IO_MQTT(mqtt_client)defpub_lamp(lamp):iftype(lamp)==str:lamp=eval(lamp)# pylint: disable=eval-usediot.publish("lamp",str(notlamp))# funhouse.set_text(f"Lamp: {not lamp}", 0)time.sleep(0.3)iot=Hub(display=display,io=io,nav=(up,select,down,back,submit))iot.add_device(feed_key="lamp",default_text="Lamp: ",formatted_text="Lamp:{}",pub_method=pub_lamp,)iot.add_device(feed_key="temperature",default_text="Temperature: ",formatted_text="Temperature:{:.1f}C",)iot.add_device(feed_key="humidity",default_text="Humidity: ",formatted_text="Humidity:{:.2f}%")iot.get()whileTrue:iot.loop()time.sleep(0.01)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-datetime
IntroductionBasic date and time types. Implements a subset of theCPython datetime module.NOTE: This library has a large memory footprint and is intended for hardware such as the SAMD51, ESP32-S2, and nRF52.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-datetimeTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-datetimeTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-datetimeUsage Example# Example of working with a `datetime` object# from https://docs.python.org/3/library/datetime.html#examples-of-usage-datetimefromadafruit_datetimeimportdatetime,date,time# Using datetime.combine()d=date(2005,7,14)print(d)t=time(12,30)print(datetime.combine(d,t))# Using datetime.now()print("Current time (GMT +1):",datetime.now())# Using datetime.timetuple() to get tuple of all attributesdt=datetime(2006,11,21,16,30)tt=dt.timetuple()foritintt:print(it)print("Today is: ",dt.ctime())iso_date_string="2020-04-05T05:04:45.752301"print("Creating new datetime from ISO Date:",iso_date_string)isodate=datetime.fromisoformat(iso_date_string)print("Formatted back out as ISO Date: ",isodate.isoformat())DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.LicenseSee LICENSE/ for details.Copyright (c) 2001-2021 Python Software Foundation. All rights reserved.Copyright (c) 2000 BeOpen.com. All rights reserved.Copyright (c) 1995-2001 Corporation for National Research Initiatives. All rights reserved.Copyright (c) 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
adafruit-circuitpython-debouncer
IntroductionDebounces an arbitrary predicate function (typically created as a lambda) of 0 arguments. The constructor also accepts a digital pin as a convienence.DependenciesThis driver depends on:Adafruit CircuitPythonAdafruit TicksPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Usage Exampleimportboardimportdigitaliofromadafruit_debouncerimportDebouncerpin=digitalio.DigitalInOut(board.D12)pin.direction=digitalio.Direction.INPUTpin.pull=digitalio.Pull.UPswitch=Debouncer(pin)whileTrue:switch.update()ifswitch.fell:print('Just pressed')ifswitch.rose:print('Just released')ifswitch.value:print('not pressed')else:print('pressed')DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-debug-i2c
IntroductionWrapper library for debugging I2C.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Usage ExampleThis example uses the LIS3DH accelerometer. This lib can be used with any I2C device. Save the code to your board.importadafruit_lis3dhfromadafruit_debug_i2cimportDebugI2Cimportbusioimportboardimportdigitalioi2c=DebugI2C(busio.I2C(board.SCL,board.SDA))int1=digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)accelerometer=adafruit_lis3dh.LIS3DH_I2C(i2c,address=0x19,int1=int1)print(accelerometer.acceleration)foriinrange(2):print(accelerometer.acceleration)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.Building locallyZip release filesTo build this library locally you’ll need to install thecircuitpython-build-toolspackage.python3-mvenv.venvsource.venv/bin/activatepipinstallcircuitpython-build-toolsOnce installed, make sure you are in the virtual environment:source.venv/bin/activateThen run the build:circuitpython-build-bundles--filename_prefixadafruit-circuitpython-debug_i2c--library_location.Sphinx documentationSphinx is used to build the documentation based on rST files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):python3-mvenv.venvsource.venv/bin/activatepipinstallSphinxsphinx-rtd-themeNow, once you have the virtual environment activated:cddocssphinx-build-E-W-bhtml._build/htmlThis will output the documentation todocs/_build/html. Open the index.html in your browser to view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to locally verify it will pass.
adafruit-circuitpython-dht
IntroductionCircuitPython support for the DHT11 and DHT22 temperature and humidity devices.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.NoteThis library uses thepulseiomodule in CircuitPython. As of CircuitPython 7.0.0,pulseiois no longer available on the smallest CircuitPython builds, such as the Trinket M0, Gemma M0, and Feather M0 Basic boards. You can substitute a more modern sensor, which will work better as well. See the guideModern Replacements for DHT11 and DHT22 Sensorsfor suggestions.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-dhtTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-dhtTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-dhtUsage ExampleHardware Set-upDesigned specifically to work with the Adafruit DHT series sensors:AdafruitDHT22 temperature-humidity sensor + extrasAdafruitDHT11 temperature-humidity sensor + extrasNoteDHT11 and DHT22 devices both need a pull-resistor on the data signal wire. This resistor is in the range of 1k to 5kPlease check the device datasheet for the appropriate value.Be sure that you are running the Buster Operating System.Make sure that your user is part of thegpiogroup.Known IssuesThe library may or may not work in Linux 64-bit platforms.The Raspberry PI Zero does not provide reliable readings.Readings in FeatherS2 does not work as expected.NoteUsing a more modern sensor will avoid these issues. See the guideModern Replacements for DHT11 and DHT22 Sensors.BasicsOf course, you must import the library to use it:importadafruit_dhtThe DHT type devices use single data wire, so import the board pinfromboardimport<pin>Now, to initialize the DHT11 device:dht_device=adafruit_dht.DHT11(<pin>)OR initialize the DHT22 device:dht_device=adafruit_dht.DHT22(<pin>)Read temperature and humidityNow get the temperature and humidity valuestemperature=dht_device.temperaturehumidity=dht_device.humidityThese properties may raise an exception if a problem occurs. You should use try/raise logic and catch RuntimeError and then retry getting the values after at least 2 seconds. If you try again to get a result within 2 seconds, cached values are returned.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-display-button
IntroductionUI Buttons for displayioDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-display-buttonTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-display-buttonTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-display-buttonUsage ExampleSee examples in examples/ folder.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.Building locallyZip release filesTo build this library locally you’ll need to install thecircuitpython-build-toolspackage.python3-mvenv.venvsource.venv/bin/activatepipinstallcircuitpython-build-toolsOnce installed, make sure you are in the virtual environment:source.venv/bin/activateThen run the build:circuitpython-build-bundles--filename_prefixadafruit-circuitpython-display_button--library_location.Sphinx documentationSphinx is used to build the documentation based on rST files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):python3-mvenv.venvsource.venv/bin/activatepipinstallSphinxsphinx-rtd-themeNow, once you have the virtual environment activated:cddocssphinx-build-E-W-bhtml._build/htmlThis will output the documentation todocs/_build/html. Open the index.html in your browser to view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to locally verify it will pass.
adafruit-circuitpython-displayio-flipclock
IntroductionDisplayIO widgets for showing flip clock style animattions changing from one number to another.DependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterCedarGrove PaletteFaderThis command can be used to install the PaletteFader:circupinstallcedargrove_palettefaderPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Purchase Feather ESP32-S2 TFT from the Adafruit shopInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-displayio-flipclockTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-displayio-flipclockTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.env/bin/activatepip3installadafruit-circuitpython-displayio-flipclockInstalling to a Connected CircuitPython Device with CircupMake sure that you havecircupinstalled in your Python environment. Install it with the following command if necessary:pip3installcircupWithcircupinstalled and your CircuitPython device connected use the following command to install:circupinstalladafruit_displayio_flipclockOr the following command to update an existing version:circupupdateUsage ExampleimporttimefromdisplayioimportGroupimportboardimportadafruit_imageloadfromadafruit_displayio_flipclock.flip_digitimportFlipDigitANIMATION_DELAY=0.02ANIMATION_FRAME_COUNT=10TRANSPARENT_INDEXES=range(11)BRIGHTER_LEVEL=0.99DARKER_LEVEL=0.5MEDIUM_LEVEL=0.9display=board.DISPLAYmain_group=Group()static_spritesheet,static_palette=adafruit_imageload.load("static_sheet.bmp")static_palette.make_transparent(0)top_animation_spritesheet,top_animation_palette=adafruit_imageload.load("grey_top_animation_sheet.bmp")bottom_animation_spritesheet,bottom_animation_palette=adafruit_imageload.load("grey_bottom_animation_sheet.bmp")foriinTRANSPARENT_INDEXES:top_animation_palette.make_transparent(i)bottom_animation_palette.make_transparent(i)SPRITE_WIDTH=static_spritesheet.width//3SPRITE_HEIGHT=(static_spritesheet.height//4)//2flip_digit=FlipDigit(static_spritesheet,static_palette,top_animation_spritesheet,top_animation_palette,bottom_animation_spritesheet,bottom_animation_palette,SPRITE_WIDTH,SPRITE_HEIGHT,anim_frame_count=ANIMATION_FRAME_COUNT,anim_delay=ANIMATION_DELAY,brighter_level=BRIGHTER_LEVEL,darker_level=DARKER_LEVEL,medium_level=MEDIUM_LEVEL,)flip_digit.anchor_point=(0.5,0.5)flip_digit.anchored_position=(display.width//2,display.height//2)main_group.append(flip_digit)display.root_group=main_groupwhileTrue:foriinrange(10):flip_digit.value=itime.sleep(0.75)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-displayio-layout
IntroductionCircuitPython helper library for displayio layouts and widgets.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-displayio-layoutTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-displayio-layoutTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-displayio-layoutUsage ExampleSee scripts in the examples directory of this repository.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-displayio-sh1106
IntroductionDisplayIO compatible library for SH1106 OLED displaysDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundleor individual libraries can be installed usingcircup.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-displayio-sh1106To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-displayio-sh1106To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-displayio-sh1106Usage Exampleimportbusioimportdisplayioimportterminalioimportfourwirefromadafruit_display_textimportlabelimportadafruit_displayio_sh1106displayio.release_displays()spi=busio.SPI(board.SCK,board.MOSI)display_bus=fourwire.FourWire(spi,command=board.OLED_DC,chip_select=board.OLED_CS,reset=board.OLED_RESET,baudrate=1000000,)WIDTH=128HEIGHT=64BORDER=5display=adafruit_displayio_sh1106.SH1106(display_bus,width=WIDTH,height=HEIGHT)# Make the display contextsplash=displayio.Group()display.root_group=splashcolor_bitmap=displayio.Bitmap(WIDTH,HEIGHT,1)color_palette=displayio.Palette(1)color_palette[0]=0xFFFFFF# Whitebg_sprite=displayio.TileGrid(color_bitmap,pixel_shader=color_palette,x=0,y=0)splash.append(bg_sprite)# Draw a smaller inner rectangleinner_bitmap=displayio.Bitmap(WIDTH-BORDER*2,HEIGHT-BORDER*2,1)inner_palette=displayio.Palette(1)inner_palette[0]=0x000000# Blackinner_sprite=displayio.TileGrid(inner_bitmap,pixel_shader=inner_palette,x=BORDER,y=BORDER)splash.append(inner_sprite)# Draw a labeltext="Hello World!"text_area=label.Label(terminalio.FONT,text=text,color=0xFFFFFF,x=28,y=HEIGHT//2-1)splash.append(text_area)whileTrue:passDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-displayio-sh1107
IntroductionDisplayIO driver for SH1107 monochrome displays. DisplayIO drivers enable terminal output.DependenciesThis driver depends on:Adafruit CircuitPython Version 6+A new quirk in 6.0 for SH1107An SH1107 OLED display, eg.Adafruit FeatherWing 128 x 64 OLEDPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading theAdafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-displayio-sh1107To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-displayio-sh1107To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-displayio-sh1107Usage Exampleimportboardimportdisplayioimportterminalioimportbitmap_labelaslabel# from adafruit_display_textimportadafruit_displayio_sh1107displayio.release_displays()#oled_reset = board.D9# Use for I2Ci2c=board.I2C()display_bus=displayio.I2CDisplay(i2c,device_address=0x3C)# SH1107 is vertically oriented 64x128WIDTH=128HEIGHT=64BORDER=2display=adafruit_displayio_sh1107.SH1107(display_bus,width=WIDTH,height=HEIGHT)# Make the display contextsplash=displayio.Group()display.root_group=splashcolor_bitmap=displayio.Bitmap(WIDTH,HEIGHT,1)color_palette=displayio.Palette(1)color_palette[0]=0xFFFFFF# Whitebg_sprite=displayio.TileGrid(color_bitmap,pixel_shader=color_palette,x=0,y=0)splash.append(bg_sprite)# Draw a smaller inner rectangle in blackinner_bitmap=displayio.Bitmap(WIDTH-BORDER*2,HEIGHT-BORDER*2,1)inner_palette=displayio.Palette(1)inner_palette[0]=0x000000# Blackinner_sprite=displayio.TileGrid(inner_bitmap,pixel_shader=inner_palette,x=BORDER,y=BORDER)splash.append(inner_sprite)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-displayio-ssd1305
IntroductionDisplayIO driver for SSD1305 monochrome displaysFor the framebuf based driver seeAdafruit CircuitPython SSD1305.DependenciesThis driver depends on:Adafruit CircuitPython Version 5+Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-displayio-ssd1305To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-displayio-ssd1305To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-displayio-ssd1305Usage Exampleimportboardimportdisplayio# Starting in CircuitPython 9.x fourwire will be a seperate internal library# rather than a component of the displayio librarytry:fromfourwireimportFourWire# Use for I2C# from i2cdisplaybus import I2CDisplayBusexceptImportError:fromdisplayioimportFourWire# from displayio import I2CDisplay as I2CDisplayBusimportterminaliofromadafruit_display_textimportlabelimportadafruit_displayio_ssd1305displayio.release_displays()# Use for SPIspi=board.SPI()oled_cs=board.D5oled_dc=board.D6display_bus=FourWire(spi,command=oled_dc,chip_select=oled_cs,baudrate=1000000,reset=board.D9)# Use for I2C# i2c = board.I2C()## display_bus = I2CDisplayBus(i1c, device_address=0x3c)WIDTH=128HEIGHT=64# Change to 32 if neededBORDER=8FONTSCALE=1display=adafruit_displayio_ssd1305.SSD1305(display_bus,width=WIDTH,height=HEIGHT)# Make the display contextsplash=displayio.Group()display.root_group=splashcolor_bitmap=displayio.Bitmap(display.width,display.height,1)color_palette=displayio.Palette(1)color_palette[0]=0xFFFFFF# Whitebg_sprite=displayio.TileGrid(color_bitmap,pixel_shader=color_palette,x=0,y=0)splash.append(bg_sprite)# Draw a smaller inner rectangleinner_bitmap=displayio.Bitmap(display.width-BORDER*2,display.height-BORDER*2,1)inner_palette=displayio.Palette(1)inner_palette[0]=0x000000# Blackinner_sprite=displayio.TileGrid(inner_bitmap,pixel_shader=inner_palette,x=BORDER,y=BORDER)splash.append(inner_sprite)# Draw a labeltext="Hello World!"text_area=label.Label(terminalio.FONT,text=text,color=0xFFFFFF)text_width=text_area.bounding_box[2]*FONTSCALEtext_group=displayio.Group(scale=FONTSCALE,x=display.width//2-text_width//2,y=display.height//2)text_group.append(text_area)# Subgroup for text scalingsplash.append(text_group)whileTrue:passDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-displayio-ssd1306
IntroductionDisplayIO driver for SSD1306 monochrome displays. DisplayIO drivers enable terminal outputFor the framebuf based driver seeAdafruit CircuitPython SSD1306.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-displayio-ssd1306To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-displayio-ssd1306To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-displayio-ssd1306Usage Exampleimportboardimportdisplayioimportadafruit_displayio_ssd1306importbusiodisplayio.release_displays()# This pinout works on a Metro and may need to be altered for other boards.spi=busio.SPI(board.SCL,board.SDA)tft_cs=board.D9tft_dc=board.D8tft_reset=board.D7display_bus=displayio.FourWire(spi,command=tft_dc,chip_select=tft_cs,reset=tft_reset,baudrate=1000000)display=adafruit_displayio_ssd1306.SSD1306(display_bus,width=128,height=64)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-display-notification
IntroductionDisplayio Widgets for displaying notificationsDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPINoteThis library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-display-notificationTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-display-notificationTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-display-notificationUsage ExampleSee theexamplesfolder.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-display-shapes
IntroductionVarious common shapes for use with displayioDependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-display_shapesTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-display_shapesTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-display_shapesUsage Exampleimportboardimportdisplayiofromadafruit_display_shapes.rectimportRectfromadafruit_display_shapes.circleimportCirclefromadafruit_display_shapes.arcimportArcfromadafruit_display_shapes.roundrectimportRoundRectsplash=displayio.Group()board.DISPLAY.root_group=splashcolor_bitmap=displayio.Bitmap(320,240,1)color_palette=displayio.Palette(1)color_palette[0]=0xFFFFFFbg_sprite=displayio.TileGrid(color_bitmap,pixel_shader=color_palette,position=(0,0))print(bg_sprite.position)splash.append(bg_sprite)triangle=Triangle(170,50,120,140,210,160,fill=0x00FF00,outline=0xFF00FF)splash.append(triangle)rect=Rect(80,20,41,41,fill=0x0)splash.append(rect)circle=Circle(100,100,20,fill=0x00FF00,outline=0xFF00FF)splash.append(circle)arc=Arc(x=100,y=100,radius=25,angle=45,direction=90,segments=10,outline=0x00FF00)splash.append(arc)rect2=Rect(50,100,61,81,outline=0x0,stroke=3)splash.append(rect2)roundrect=RoundRect(10,10,61,81,10,fill=0x0,outline=0xFF00FF,stroke=6)splash.append(roundrect)whileTrue:passDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.Building locallyZip release filesTo build this library locally you’ll need to install thecircuitpython-build-toolspackage.python3-mvenv.venvsource.venv/bin/activatepipinstallcircuitpython-build-toolsOnce installed, make sure you are in the virtual environment:source.venv/bin/activateThen run the build:circuitpython-build-bundles--filename_prefixadafruit-circuitpython-display_shapes--library_location.Sphinx documentationSphinx is used to build the documentation based on rST files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):python3-mvenv.venvsource.venv/bin/activatepipinstallSphinxsphinx-rtd-themeNow, once you have the virtual environment activated:cddocssphinx-build-E-W-bhtml._build/htmlThis will output the documentation todocs/_build/html. Open the index.html in your browser to view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to locally verify it will pass.
adafruit-circuitpython-display-text
IntroductionDisplays text using CircuitPython’s displayio.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Usage ExampleFor a board with a built-in display.importboardimportterminaliofromadafruit_display_textimportlabeltext="Hello world"text_area=label.Label(terminalio.FONT,text=text)text_area.x=10text_area.y=10board.DISPLAY.root_group=text_areawhileTrue:passDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-dotstar
Adafruit CircuitPython DotStarHigher level DotStar driver that presents the strip as a sequence. It is the same api as theNeoPixel library.Colors are stored as tuples by default. However, you can also use int hex syntax to set values similar to colors on the web. For example,0x100000(#100000on the web) is equivalent to(0x10, 0, 0).If you send a tuple with 4 values, you can control the brightness value, which appears in DotStar but not NeoPixels. It should be a float. For example, (0xFF,0,0, 1.0) is the brightest red possible, (1,0,0,0.01) is the dimmest red possible.NoteThe int hex API represents the brightness of the white pixel when present by setting the RGB channels to identical values. For example, full white is 0xffffff but is actually (0xff, 0xff, 0xff) in the tuple syntax.DependenciesThis driver depends on:Adafruit CircuitPythonPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-dotstarTo install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-dotstarTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-dotstarUsage ExampleThis example demonstrates the library with the single built-in DotStar on theTrinket M0andGemma M0.importboardimportadafruit_dotstarpixels=adafruit_dotstar.DotStar(board.APA102_SCK,board.APA102_MOSI,1)pixels[0]=(10,0,0)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-dps310
IntroductionLibrary for the DPS310 Precision Barometric Pressure SensorDependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-dps310To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-dps310To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-dps310Installing to a connected CircuitPython DeviceSome devices, eg. the QT-PY, are very limited in memory. The DPS310 library contains two variants - basic and advanced - which give different levels of functionality.Installing the DPS310 library could have the following outcomes:It installs successfully and your code runs successfully. Woo-hoo! Continue with your amazing project.It installs successfully and your code fails to run with a memory allocation error. Try one of the following:If yourcode.pyis large, especially if it has lots of comments, you can shrink it into a.mpyfile instead. See the AdafruitLearn Guideon shrinking your code.Only use the basic DPS310 implementation, and remove the following file:<CIRCUITPY>/lib/adafruit_dps310/advanced.mpywhere <CIRCUITPY> is the mounted location of your device. Make sure that your code only uses the basic implementation.Usage Exampleimporttimeimportboardfromadafruit_dps310.basicimportDPS310i2c=board.I2C()# uses board.SCL and board.SDAdps310=DPS310(i2c)whileTrue:print("Temperature =%.2f*C"%dps310.temperature)print("Pressure =%.2fhPa"%dps310.pressure)print("")time.sleep(1.0)Known IssuesLibrary extensive features might not be compatible with memory limited boards. For these kind of boards you need to use theadafruit_dps310/basic.mpy, the file needs to be in thempyformat in order to fit in memory. For boards with more memory available you could use the code present inadafruit_dps310/advanced.py. For usage refer todps310_simpletest_advanced.pyDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-drv2605
IntroductionCircuitPython module for the DRV2605 haptic feedback motor driver.DependenciesThis driver depends on:Adafruit CircuitPythonBus DevicePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-drv2605To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-drv2605To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-drv2605Usage ExampleSee examples/drv2605_simpletest.py for a demo of the usage.DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ds1307
IntroductionThis is a great battery-backed real time clock (RTC) that allows your microcontroller project to keep track of time even if it is reprogrammed, or if the power is lost. Perfect for datalogging, clock-building, time stamping, timers and alarms, etc. The DS1307 is the most popular RTC - but it requires 5V power to work.The DS1307 is simple and inexpensive but not a high precision device. It may lose or gain up to two seconds a day. For a high-precision, temperature compensated alternative, please check out theDS3231 precision RTC. If you do not need a DS1307, or you need a 3.3V-power/logic capable RTC please check out our affordablePCF8523 RTC breakout.DependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ds1307To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ds1307To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ds1307Usage NotesOf course, you must import the library to use it:importboardimportadafruit_ds1307importtimeAll the Adafruit RTC libraries take an instantiated and active I2C object (from theboardlibrary) as an argument to their constructor. The way to create an I2C object depends on the board you are using. For boards with labeled SCL and SDA pins, you can:importboardNow, to initialize the I2C bus:i2c=board.I2C()Once you have created the I2C interface object, you can use it to instantiate the RTC object:rtc=adafruit_ds1307.DS1307(i2c)To set the time, you need to setdatetimeto atime.struct_timeobject:rtc.datetime=time.struct_time((2017,1,9,15,6,0,0,9,-1))After the RTC is set, you retrieve the time by reading thedatetimeattribute and access the standard attributes of a struct_time such astm_year,tm_hourandtm_min.t=rtc.datetimeprint(t)print(t.tm_hour,t.tm_min)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ds1841
IntroductionCircuitPython library for the Maxim DS1841 I2C Logarithmic ResistorDependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ds1841To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ds1841To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ds1841Usage Examplefromtimeimportsleepimportboardimportbusioimportadafruit_ds1841fromanalogioimportAnalogIn####### NOTE ################# this example will not work with Blinka/rasberry Pi due to the lack of analog pins.# Blinka and Raspberry Pi users should run the "ds1841_blinka_simpletest.py" example# WIRING:# 1 Wire connecting VCC to RH to make a voltage divider using the# internal resistor between RH and RW# 2 Wire connecting RW to A0i2c=busio.I2C(board.SCL,board.SDA)ds1841=adafruit_ds1841.DS1841(i2c)wiper_output=AnalogIn(board.A0)whileTrue:ds1841.wiper=127print("Wiper set to%d"%ds1841.wiper)voltage=wiper_output.valuevoltage*=3.3voltage/=65535print("Wiper voltage:%.2f"%voltage)print("")sleep(1.0)ds1841.wiper=0print("Wiper set to%d"%ds1841.wiper)voltage=wiper_output.valuevoltage*=3.3voltage/=65535print("Wiper voltage:%.2f"%voltage)print("")sleep(1.0)ds1841.wiper=63print("Wiper set to%d"%ds1841.wiper)voltage=wiper_output.valuevoltage*=3.3voltage/=65535print("Wiper voltage:%.2f"%voltage)print("")sleep(1.0)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ds18x20
IntroductionCircuitPython driver for Dallas 1-Wire temperature sensor.DependenciesThis driver depends on:Adafruit CircuitPythonAdafruit OneWirePlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Usage Exampleimportboardfromadafruit_onewire.busimportOneWireBusfromadafruit_ds18x20importDS18X20ow_bus=OneWireBus(board.D2)ds18=DS18X20(ow_bus,ow_bus.scan()[0])ds18.temperatureDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ds2413
IntroductionCircuitPython driver for the DS2413 one wire 2 channel GPIO breakout.DependenciesThis driver depends on:Adafruit CircuitPythonAdafruit OneWireNote:This library depends on the OneWire library and willnotwork on the Raspberry PiPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ds2413To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ds2413To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ds2413Usage Exampleimporttimeimportboardfromadafruit_onewire.busimportOneWireBusimportadafruit_ds2413ow_bus=OneWireBus(board.D2)ds=adafruit_ds2413.DS2413(ow_bus,ow_bus.scan()[0])led=ds.IOAbutton=ds.IOBbutton.direction=adafruit_ds2413.INPUTwhilenotbutton.value:led.value=Truetime.sleep(0.5)led.value=Falsetime.sleep(0.5)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ds3231
IntroductionThe datasheet for the DS3231 explains that this part is an “Extremely Accurate I²C-Integrated RTC/TCXO/Crystal”. And, hey, it does exactly what it says on the tin! This Real Time Clock (RTC) is the most precise you can get in a small, low power package.Most RTCs use an external 32kHz timing crystal that is used to keep time with low current draw. And that’s all well and good, but those crystals have slight drift, particularly when the temperature changes (the temperature changes the oscillation frequency very very very slightly but it does add up!) This RTC is in a beefy package because the crystal is inside the chip! And right next to the integrated crystal is a temperature sensor. That sensor compensates for the frequency changes by adding or removing clock ticks so that the timekeeping stays on schedule.This is the finest RTC you can get, and now we have it in a compact, breadboard-friendly breakout. With a coin cell plugged into the back, you can get years of precision timekeeping, even when main power is lost. Great for datalogging and clocks, or anything where you need to really know the time.DependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ds3231To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ds3231To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ds3231Usage NotesBasicsOf course, you must import the library to use it:importadafruit_ds3231importtimeAll the Adafruit RTC libraries take an instantiated and active I2C object (from theboardlibrary) as an argument to their constructor. The way to create an I2C object depends on the board you are using. For boards with labeled SCL and SDA pins, you can:importboardNow, to initialize the I2C bus:i2c=board.I2C()# uses board.SCL and board.SDAOnce you have created the I2C interface object, you can use it to instantiate the RTC object:rtc=adafruit_ds3231.DS3231(i2c)Date and timeTo set the time, you need to setdatetimeto atime.struct_timeobject:rtc.datetime=time.struct_time((2017,1,9,15,6,0,0,9,-1))After the RTC is set, you retrieve the time by reading thedatetimeattribute and access the standard attributes of a struct_time such astm_year,tm_hourandtm_min.t=rtc.datetimeprint(t)print(t.tm_hour,t.tm_min)AlarmTo set the time, you need to setalarm1oralarm2to a tuple with atime.struct_timeobject and string representing the frequency such as “hourly”:rtc.alarm1=(time.struct_time((2017,1,9,15,6,0,0,9,-1)),"daily")After the RTC is set, you retrieve the alarm status by reading the correspondingalarm1_statusoralarm2_statusattributes. Once True, set it back to False to reset.ifrtc.alarm1_status:print("wake up!")rtc.alarm1_status=FalseDocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.
adafruit-circuitpython-ds3502
IntroductionCircuitPython library for the Maxim DS3502 I2C PotentiometerDependenciesThis driver depends on:Adafruit CircuitPythonBus DeviceRegisterPlease ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloadingthe Adafruit library and driver bundle.Installing from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom PyPI. To install for current user:pip3installadafruit-circuitpython-ds3502To install system-wide (this may be required in some cases):sudopip3installadafruit-circuitpython-ds3502To install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.venvsource.venv/bin/activatepip3installadafruit-circuitpython-ds3502Usage Examplefromtimeimportsleepimportboardimportadafruit_ds3502fromanalogioimportAnalogIn####### NOTE ################# this example will not work with Blinka/rasberry Pi due to the lack of analog pins.# Blinka and Raspberry Pi users should run the "ds3502_blinka_simpletest.py" examplei2c=board.I2C()ds3502=adafruit_ds3502.DS3502(i2c)wiper_output=AnalogIn(board.A0)whileTrue:ds3502.wiper=127print("Wiper set to%d"%ds3502.wiper)voltage=wiper_output.valuevoltage*=3.3voltage/=65535print("Wiper voltage:%.2f"%voltage)print("")sleep(1.0)ds3502.wiper=0print("Wiper set to%d"%ds3502.wiper)voltage=wiper_output.valuevoltage*=3.3voltage/=65535print("Wiper voltage:%.2f"%voltage)print("")sleep(1.0)ds3502.wiper=63print("Wiper set to%d"%ds3502.wiper)voltage=wiper_output.valuevoltage*=3.3voltage/=65535print("Wiper voltage:%.2f"%voltage)print("")sleep(1.0)DocumentationAPI documentation for this library can be found onRead the Docs.For information on building library documentation, please check outthis guide.ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.