Option Explicit sub WatchBumpers() 'this task will monitor the bumper switches do while running = 1 if (getpin(LeftBumper) = 0) or (getpin(RightBumper) = 0) then Register.OCR1AH = 0 'turn off the motors Register.OCR1AL = 0 Register.OCR1BH = 0 Register.OCR1BL = 0 end if sleep(0.0) 'release some time loop end sub function LeftBumperPressed() as boolean if getpin(LeftBumper) = 0 then LeftBumperPressed = true else LeftBumperPressed = false end if end function function RightBumperPressed() as boolean if getpin(RightBumper) = 0 then RightBumperPressed = true else RightBumperPressed = false end if end function function BothBumpersPressed() as boolean if (getpin(LeftBumper) = 0) and (getpin(RightBumper) = 0) then BothBumpersPressed = true else BothBumpersPressed = false end if end function