Using the LED Bumper#
Use the LED Bumper’s pressed? Boolean in VEXcode GO to turn the LED Bumper green while it’s pressed.
Make sure your robot has an LED Bumper connected. See Configuring Devices if you haven’t added one yet.
Attach a forever block below the when started block.
cuando inicie :: hat events
por siempre
fin
Inside the forever block, attach an if / else block.
cuando inicie :: hat events
por siempre
si <> entonces
si no
fin
fin
Drag the LED Bumper’s pressed? Boolean block into the if/else block’s condition slot.
cuando inicie :: hat events
por siempre
si <¿[LEDBumper2 v] presionado? :: custom-led> entonces
si no
fin
fin
In the if branch, attach a Set Bumper color block.
cuando inicie :: hat events
por siempre
si <¿[LEDBumper2 v] presionado? :: custom-led> entonces
establecer [LEDBumper2 v] a [rojo v] :: custom-led
si no
fin
fin
Change the color parameter to green.
In the else branch, attach another Set Bumper color block.
cuando inicie :: hat events
por siempre
si <¿[LEDBumper2 v] presionado? :: custom-led> entonces
establecer [LEDBumper2 v] a [verde v] :: custom-led
si no
establecer [LEDBumper2 v] a [rojo v] :: custom-led
fin
fin
Change the color parameter to off.
Make sure your robot is connected to VEXcode. See Connecting to Your Robot if it isn’t connected yet.
Select Start to run the project, then press the LED Bumper. It will light up green while pressed, and turn off when released.