Vison Sensor Help

So I have a video new members can’t attach files but in short my problem is.
I coded it to sense orange objects use the example renaming things in it

event checkPurple = event();
event checkGreen = event();
event checkOrange = event();

void hasPurpleCallback() {
Brain.Screen.setFont(mono40);
Brain.Screen.clearLine(1, black);
Brain.Screen.setCursor(Brain.Screen.row(), 1);
Brain.Screen.setCursor(1, 1);
Eye.takeSnapshot(Eye__PURPLE_CUBE);
if (Eye.objectCount > 0) {
Brain.Screen.print(“Purple Object Found”);
} else {
Brain.Screen.print(“No Purple Object”);
}
}

void hasGreenCallback() {
Brain.Screen.setFont(mono40);
Brain.Screen.clearLine(3, black);
Brain.Screen.setCursor(Brain.Screen.row(), 1);
Brain.Screen.setCursor(3, 1);
Eye.takeSnapshot(Eye__GREEN_CUBE);
if (Eye.objectCount > 0) {
Brain.Screen.print(“Green Object Found”);
} else {
Brain.Screen.print(“No Green Object”);
}
}

void hasOrangeCallback() {
Brain.Screen.setFont(mono40);
Brain.Screen.clearLine(5, black);
Brain.Screen.setCursor(Brain.Screen.row(), 1);
Brain.Screen.setCursor(5, 1);
Eye.takeSnapshot(Eye__ORANGE_CUBE);
if (Eye.objectCount > 0) {
Brain.Screen.print(“Orange Object Found”);
} else {
Brain.Screen.print(“No Orange Object”);
}
}

but when I put it in my robot it does not see it can someone please help

Are your color signatures working? I have never used the objectCount attribute, so can’t say if that is reliable or not. Other than that, your functions look good.

Im using Orange, Green, and Purple the colors of the tower takeover cubes

I don’t use vexcode, but what is the Eye__PURPLE_CUBE object, and have you set up the colour signatures in the V5 vision utility yet?

Im not sure exactly but the Eye is what I named the sensor

It may be that you haven’t defined “PURPLE_CUBE” and need to either hard code it or set it up in the vision sensor software (may be built into vexcode, I don’t use it)

You may find it helpful to review examples from the links to vision sensor help that I found for this post: I need help with the vision sensor

Also, this: Vision Sensor config - objectCount inconsistent

1 Like

how do I upload files

If you mean your source code, then you include it in your post surrounded by the [code] ... [/code] tags. Or if you mean vision sensor signatures, then there is a utility for that: Vision sensor setup

1 Like

i ment on the reply thing like when you type a reply

Yes, that’s what @weilin meant too - copy your program and paste it into a reply, including [code] before it and [ /code] (without the errant space) after it.

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.