Teknologiskolen

RC2019 – Color-sensor assignment – 1

Explanation: The code prints the raw R(ed), G(reen), B(lue) and W(hite) values from sensor, in the serial monitor.

Place the sensor on top of a red item, and write down the raw RGBW-values, now do the same for a blue, green and yellow item.

Then type in the RGBW-values, into the specific colors found in the function setColors(), at line 54-57.

Example, if when placed on a red item, the RGBW-values are as following: 40, 104, 22, 81. Then the color red should be registered by typing in these into the colors.setRed() function at line 54.

When all of the colors have been registered and typed in, the color.getColor() function, will work properly in relation to the colors of the items you’ve selected.

The condition will therefore be functional and evaluate the read color, and print the related message in the serial monitor.

READ ME NOTE: In order to enable the inclusion of the Color library, copy paste the entire Color Library folder, into the “Documents -> Arduino -> Libraries” folder.