VCS vision sensor help explain

I am trying to program some sensors. Can someone please break this down to make it easier to understand?
using namespace vex;
vex::brain Brain;
vex::motor LeftMotor (vex::PORT1, vex::gearSetting::ratio18_1, false);
vex::motor RightMotor (vex::PORT10, vex::gearSetting:ratio18_1, true);
vex::vision VisionSensor (vex::PORT5);

  • vex::vision is a Class in C++
  • VisionSensor is an instance of the Class type vex::vision, also referred to as an Object in C++.
  • You’re passing the Class constructor function the variable vex::PORT5.

In other words, you’re creating an object of the vex::vision class, named VisionSensor, and passing the constructor the variable vex::PORT5.

See here for the API details.

See here for a tutorial on setting up the vision sensor.

Google “C++ class and object” for a lot of good tutorials.

can you explain the false and true parts of that.

The API is your best friend.

The false and true in the motor declarations are whether or not the motor is reversed. True would mean reversed.

1 Like