V5 Vision Sensor help with C++ VCS

Hello guys, so I am VERY new to the V5 Vision Sensor and never used it before. I use VCS C++ and I need some help on how to make count how many colors it sees (For example cube color it sees). And then it would tell me how much I have and put it on my controller. :smiley:

Well, you could use

vex::vision.takeSnapshot

several times rapidly in succession, once for each color you’re looking for. In each case you could augment a counter or not based on

vex::vision::object.exists

However, since you haven’t used the vision sensor before, I recommend starting differently. First get used to just finding an object. Try using the same two methods I just gave along with essentially the same if statement you would use. But just print to the brain/controller if it sees a given signature or not. Once you have that down, adding more signatures isn’t so tough.

Thank you for the help I think I got it. :smiley: If I have anymore questions I will ask.

see this for setup

also, passing a signature of 0 to takeSnapshot matches all objects, you can then just iterate through the array of objects and check the signature of each one.