''' Mission 6: Heartbeat Sample code - start with duplicating code for repeating, then using an infinite while loop. End with using two buttons to control the speed of the heartbeat. Code has a potential runtime error, since delay can go 0 or below. Loop remains infinite. ''' from codex import * from time import sleep delay = 1 while True: # one heartbeat display.show(pics.HEART) sleep(delay) display.show(pics.HEART_SMALL) sleep(delay) if buttons.was_pressed(BTN_A): delay = delay + 0.2 if buttons.was_pressed(BTN_B): delay = delay - 0.2