The mkII Astro Pi Flight Units carry a custom Sense HAT that includes a TCS34725 colour sensor, capable of measuring the amount of Red, Green and Blue (RGB) in the incident light, as well as providing a Clear light (brightness) reading.
To support interaction with this sensor, the Flight OS includes a custom-built sense_hat
Python library. The SenseHat
class provides a colour
(or color
) attribute which corresponds to a ColourSensor
object and provides access to the colour sensor.
The example below serves as an overview of how the colour sensor can be used, while the sections that follow provide additional details and explanations.
from sense_hat import SenseHat