Using the LED Bumper#

Using the LED Bumper

Use the LED Bumper’s pressed? Boolean in VEXcode GO to turn the LED Bumper green while it’s pressed.

  1. Make sure your robot has an LED Bumper connected. See Configuring Devices if you haven’t added one yet.

Screenshot of the Devices tab, showing LEDBumper2 in the list of devices.
  1. Attach a forever block below the when started block.

Check the LED Bumper repeatedly.#
cuando inicie :: hat events
por siempre
fin
  1. Inside the forever block, attach an if / else block.

An empty if/else block, inside forever.#
cuando inicie :: hat events
por siempre
si <> entonces
si no
fin
fin
  1. Drag the LED Bumper’s pressed? Boolean block into the if/else block’s condition slot.

Check whether the LED Bumper is pressed.#
cuando inicie :: hat events
por siempre
si <¿[LEDBumper2 v] presionado? :: custom-led> entonces
si no
fin
fin
  1. In the if branch, attach a Set Bumper color block.

The Set Bumper color block, in the if branch.#
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
  1. Change the color parameter to green.

Screenshot of the project, with the if branch's Set Bumper color block's dropdown open, showing red, green, and off options, and green selected.
  1. In the else branch, attach another Set Bumper color block.

The Set Bumper color block, in the else branch.#
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
  1. Change the color parameter to off.

Screenshot of the finished project, with the else branch's Set Bumper color block's dropdown open, showing red, green, and off options, and off selected.
  1. Make sure your robot is connected to VEXcode. See Connecting to Your Robot if it isn’t connected yet.

Screenshot of the VEXcode GO toolbar, showing the Connect button in a Connected state.
  1. Select Start to run the project, then press the LED Bumper. It will light up green while pressed, and turn off when released.

Screenshot of the VEXcode GO toolbar, with the Start button highlighted.