While I was programming, I noticed that the vex::controller
class has a boolean returning function built into it with the name installed()
. From the name, I would assume it returns whether or not the controller is connected, but it isn’t listed on help.vexcodingstudio.com. So, would I be correct to assume the behavior of this function, and is there a more up to date API reference?
1 Like
Yes, it means the controller is connected.
There’s installed method for most devices, you can use that to check that a motor or other device is actually connected to a port. For example, I posted this a few days ago.
void
stopAllMotors() {
// find all motors and send stop
for( int32_t p=vex::PORT1; p <= vex::PORT21; p++ ) {
vex::motor m( p );
if( m.installed() ) {
m.stop();
}
}
}
2 Likes
Hmm, this could be really useful for error correction. Thanks.