the “[ ]” are being shown as an error.
it was written using Vex V5 Pro
here’s the code
#include "vex.h"
brain Brain;
vex::vision::signature SIG_1 = vex::vision::signature (1, 0, 0, 0, 0, 0, 0, 2.5, 0);
vex::vision::signature SIG_2 = vex::vision::signature (2, 0, 0, 0, 0, 0, 0, 2.5, 0);
vex::vision Vision12_objectIndex = vex::vision (vex::PORT12, 50, SIG_1, SIG_2);
motor elbow = motor(PORT3);
motor claw = motor(PORT8, true);
using namespace vex;
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
}
int whenStarted1() {
while (true) { // No Vision Sensor signature selected
if (Vision12.objects[Vision12_objectIndex].width > 125.0) {
claw.spin(forward);
elbow.spin(reverse);
}
else {
if (Vision12.objectCount > 0) {
if (Vision12.objects[Vision12_objectIndex].centerX > 100.0) {
Drivetrain.turn(right);
}
if (Vision12.objects[Vision12_objectIndex].centerX < 60.0) {
Drivetrain.turn(left);
}
if (Vision12.objects[Vision12_objectIndex].centerX > 60.0 && Vision12.objects[Vision12_objectIndex].centerX < 100.0) {
if (Vision12.objects[Vision12_objectIndex].width < 125.0) {
Drivetrain.drive(forward);
}
else {
Drivetrain.stop();
}
}
}
else {
Drivetrain.setTurnVelocity(25.0, percent);
Drivetrain.turn(right);
}
}
wait(20, msec);
}
}
edit by mods: format code