adafruit_as726x
¶
Driver for the AS726x spectral sensors
Author(s): Dean Miller
Implementation Notes¶
Hardware:
Adafruit AS7262 6-Channel Visible Light / Color Sensor Breakout (Product ID: 3779)
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_as726x.AS726x¶
AS726x spectral sensor base class.
- MODE_0: int = 0¶
Continuously gather samples of violet, blue, green and yellow. Orange and red are skipped and read zero.
- MODE_1: int = 1¶
Continuously gather samples of green, yellow, orange and red. Violet and blue are skipped and read zero.
- property driver_led_current: float¶
The current limit for the driver LED in milliamps. One of:
12.5 mA
25 mA
50 mA
100 mA
- property indicator_led_current: int¶
The current limit for the indicator LED in milliamps. One of:
1 mA
2 mA
4 mA
8 mA
- start_measurement() None ¶
Begin a measurement.
This will set the device to One Shot mode and values will not change after
data_ready
untilstart_measurement()
is called again or theconversion_mode()
is changed.
- class adafruit_as726x.AS726x_I2C(i2c_bus: I2C, address: int = 73)¶
AS726x spectral sensor via I2C.
- Parameters:
Quickstart: Importing and using the AS726x
Here is an example of using the
AS726x_I2C
class. First you will need to import the libraries to use the sensorimport board from adafruit_as726x import AS726x_I2C
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sensor = AS726x_I2C(i2c)
Now you have access to the different color attributes
violet = sensor.violet blue = sensor.blue green = sensor.green yellow = sensor.yellow orange = sensor.orange red = sensor.red
- class adafruit_as726x.AS726x_UART(uart: UART)¶
AS726x spectral sensor via UART.
- Parameters:
uart (UART) – The UART connected to the sensor
Quickstart: Importing and using the AS726x
Here is an example of using the
AS726x_I2C
class. First you will need to import the libraries to use the sensorimport board from adafruit_as726x import AS726x_UART
Once this is done you can define your
board.UART
object and define your sensor objectuart = board.UART() # uses board.SCL and board.SDA sensor = AS726x_UART(uart)
Now you have access to the different color attributes
violet = sensor.violet blue = sensor.blue green = sensor.green yellow = sensor.yellow orange = sensor.orange red = sensor.red