This is our first use of the color sensor. It counts cash (Monopoly money). A the moment it counts only the 1000 and 2000 bank notes.

When money is pushed in the front slit and detected by colour sensor (very low blue value), the wheels start rotating slowly for 3/10 of a second to pull in the note and then accelerate to throw out the note at the back.

Before throwing it out the green value reading is recorded. If it is lower than a threshold, the note is counted as 1000 if it is above the threshold it is counted as 2000. The values are accumulated in a variable that is displayed after each note. There is also a light sensor but this is only there to add some ambient light that proved helpful in getting a reliable color value difference.