Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

NOTE: This is archived because the Electronics Workshop class we ported it for no longer uses this sensor. It may still work, but we use the AS7341 instead.

AS726x

Pure MicroPython driver for the AS726x RGB color sensor. Ported from Adafruit's CircuitPython driver. (Tested on RPI Pico)

Depends on our port of Adafruit's i2c_device CircuitPython library.

Example usage:

from machine import Pin, I2C
from time import sleep
from adafruit_as726x import AS726x_I2C

i2c = I2C(id=0, scl=Pin(1), sda=Pin(0))
print(i2c.scan())
print("hi")
as726x = AS726x_I2C(i2c_bus=i2c)
print("hi2")
print(as726x.temperature)
# as726x.indicator_led = True
# as726x.driver_led = True

as726x.conversion_mode = as726x.MODE_2

def graph_map(x):
    return min(int(x * 80 / 16000), 80)

# while True:
# Wait for data to be ready
# while not as726x.data_ready:
#     sleep(0.1)
#     print("(no data yet)")

print("\n")
print("V: " + graph_map(as726x.violet) * "=")
print("B: " + graph_map(as726x.blue) * "=")
print("G: " + graph_map(as726x.green) * "=")
print("Y: " + graph_map(as726x.yellow) * "=")
print("O: " + graph_map(as726x.orange) * "=")
print("R: " + graph_map(as726x.red) * "=")
sleep(0.5)

About

Pure MicroPython driver for the AS7262 Spectral (and similar) RGB color sensor. Ported from Adafruit's CircuitPython driver

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages