Help guys, I made a plastic bottle cap sorter. It works with a tcs-3200 color sensor, so when you put a bottle cap (which are painted in 4 colors, red, blue, black and yellow), a servo moves the cap to the color sensor, if its a certain color, another servo changes the direction of which it will fall to a box, so there will be 4 boxes for each color…
So the problem is that I want to count these bottle caps in the Serial monitor, I need to count each color separately, example:
Red=1 Blue=0 Black=3 Yellow= 5
I tried the ++ command, but when I start the serial monitor this happens, if i put the first cap, in this case red, the monitor appears like this:
Red= 1
Then if I put another color, for example black, it will happen this:
Black=2
The arduino is counting just the number of caps passing through the sensor, I need to count them SEPARATELY, …sort of making 4 different counters in the same arduino.
I hope that you could help me solve this problem
Thanks a lot for your help!