C++ gyro constructor

My team is a second year vex team and we are in need of a consructor to use in Vex Code to put a gyro onto our team’s robot. we managed to get it running using vex coding studio but because vex code doesn’t have a robot map we ran into some difficulties. We are using C++ (Not C++ PRO)
and this is the code that I am trying to fix.

vex::gyro Gyro1 (vex::triport::port(D));

Also we had some problems using this website
https://help.vexcodingstudio.com/
if their is a better site for this please include a link

From my understanding, C++ in VEXCode is what used to be called VEX C++ Pro in VCS. That being said, the online documentation is not especially useful there either, though I can take a stab at what the issue is here. Try this:

vex::gyro Gyro1 (vex::triport::port::D);

In C++, scope is always resolved either with ::. Since D is defined within vex::triport::port, that is how you reference it. Hopefully this works and makes sense.

I have attempted your solution but sadly it doesn’t work.
it gave me these error codes

include\vex.h:26:38: error: no type named ‘D’ in ‘vex::triport::port’
and
[error]: make process closed with exit code : 2
do you have a possible solution?

Apparently the correct code is this:

vex::gyro Gyro1 (Brain.ThreeWirePort.D);
1 Like

@nickmertin
Thank you so much for helping me with this and it will help my team for the rest of the year

No problem. If you find the VEX documentation lacking in detail, I’d suggest checking out RobotMesh’s documentation (for RobotMesh Studio). The API is (almost) the same, and while a bit less user-friendly, their documentation is significantly more thorough and detailed.

1 Like