Basic Bumper Programming

 


‚ÄčThe bumper switch gives your robotic invention the sense of touch. It can be used to detect walls or limit the motion of an arm. In this tutorial, you will be introduced to the bumper switch and program it to print messages based on touch.

Hardware required

  • VEX IQ Brain
  • Bumper

Program

The code below prints the message "PRESSED" when the bumper is pressed down, and "RELEASED" when the bumper is released.

Open the Modkit for VEX editor. Drag and drop a bumper and assign its port number. Make sure it matches that of the physical Touch LED.

Next, click on the 'Blocks' tab and make sure that you are editing the 'Bumper'.

Drag and drop a 'When Start' block onto the screen. Click on the drop-down icon and select 'BUMPER-PRESSED.' Place a 'clear LCD' block and a 'print' block underneath the 'when' block. Change the text to "PRESSED".

Next, drag a second 'When Start' block onto the screen. Click on the drop-down icon and select 'BUMPER-RELEASED.' Place a 'clear LCD' block and a 'print' block underneath the second 'when' block. Change the text to "RELEASED".

Download your program and run it on the physical VEX IQ brain. Press down on the bumper, and observe the message printed on the brain. Release the bumper, and observe how the message changes.

In this tutorial, you learned about the bumper and printed messages based on touch. There is so much more that you can do. Check out our other Getting Started guides.

Updated 28 months ago