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.
when started :: hat events
forever
end
Inside the forever block, attach an if / else block.
when started :: hat events
forever
if <> then
else
end
end
Drag the LED Bumper’s pressed? Boolean block into the if/else block’s condition slot.
when started :: hat events
forever
if <[LEDBumper2 v] pressed? :: custom-led> then
else
end
end
In the if branch, attach a Set Bumper color block.
when started :: hat events
forever
if <[LEDBumper2 v] pressed? :: custom-led> then
set [LEDBumper2 v] to [red v] :: custom-led
else
end
end
Change the color parameter to green.
In the else branch, attach another Set Bumper color block.
when started :: hat events
forever
if <[LEDBumper2 v] pressed? :: custom-led> then
set [LEDBumper2 v] to [green v] :: custom-led
else
set [LEDBumper2 v] to [red v] :: custom-led
end
end
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.