remote_control_code_enabled = True
myVariable = 0

def when_started1():
    global myVariable, remote_control_code_enabled
    touchled_8.set_color(Color.GREEN)

def onevent_bumper_2_pressed_0():
    global myVariable, remote_control_code_enabled
    remote_control_code_enabled = False
    for repeat_count in range(6):
        touchled_8.set_color(Color.RED)
        wait(0.25, SECONDS)
        touchled_8.set_color(Color.GREEN)
        wait(0.25, SECONDS)
        wait(20, MSEC)
    remote_control_code_enabled = True
    touchled_8.set_color(Color.GREEN)

# system event handlers
bumper_2.pressed(onevent_bumper_2_pressed_0)
# add 15ms delay to make sure events are registered correctly.
wait(15, MSEC)

when_started1()