How do I code a vex flashlight to turn on when a button is pressed? I’m using VEX Code Pro
I saw this post a while back, because I thought someone else would respond. Upon doing some research I am not sure if you are able to add the flashlight sensor to VEXCode Pro.
I know that it can be done on RobotC; I have never used so I am not sure.
EDIT:
I might be wrong on this but, I was playing with VEXCode and I started to using “digital_out,” which allows you to add three wire port separetly.
As I was coding, I came up with this:
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
vex::digital_out flashlight = vex::digital_out(Brain.ThreeWirePort.H);
while(true)
{
if(Controller1.ButtonL1.pressing())
{
flashlight = 1;
}
flashlight = 0;
}
You might be to turn it on using digital out. I do not have a flashlight, so I am not sure whether I am correct or not.
I hope this helps you.