Approved content
The content below is provided by a partner.
This library provides a Microsoft Makecode package for the Joy-IT SEN-Color TCS3200 color sensor. See https://joy-it.net/products/SEN-Color for more details.
By default the color sensors is connected as follows:
SEN-Color | Micro:bit |
---|---|
VCC | 3V |
GND | GND |
OE | NC (Not connected) |
LED | GND (on the color sensor) |
GND | LED (on the color sensor) |
S0 | P15 |
S1 | P1 |
S2 | P8 |
S3 | P12 |
OUT | P2 |
But the pin assignment of S0, S1, S2, S3 and OUT can be changed to any digital pins by using:
The sensor needs to be calibrated before each use. This is done by using the calibration function and holding the sensor in front of a white surface (e.g. a white sheet of paper). In the following example the calibration function is mapped to the “A”-button of the Micro:bit. This way the calibration function is always accessible.
The color component of each color can be measured. The function expects the component that you want to measure (red, green or blue) and returns the value as a numeric value.
MIT