Im trying to figure out how to use digital_in for a bool statment. However the documentation doesnt use namespace and is super hard to understand.
Simply: trying to use a push button in a if statement
public vex::digital_in::digital_in(triport::port &port)
digital_in documentation
create a digital input instance, then use function value() to read it.
vex::digital_in d1(Brain.ThreeWirePort.A);
void
foo() {
if( d1.value() == 0 ) {
// do something
}
}
note: make sure Brain has already been created before using Brain.ThreeWirePort.A
1 Like