<s> import pyb <EOL> import micropython <EOL> class Heartbeat ( object ) : <EOL> def __init__ ( self ) : <EOL> self . tick = <NUM_LIT:0> <EOL> self . led = pyb . LED ( <NUM_LIT:1> ) <EOL> tim = pyb . Timer ( <NUM_LIT:0> ) <EOL> tim . init ( prescaler = <NUM_LIT> , period = <NUM_LIT> ) <EOL> tim . callback ( self . heartbeat_cb ) <EOL> def heartbeat_cb ( self , tim ) : <EOL> if self . tick <= <NUM_LIT:3> : <EOL> self . led . toggle ( ) <EOL> self . tick = ( self . tick + <NUM_LIT:1> ) % <NUM_LIT:10> <EOL> micropython . alloc_emergency_exception_buf ( <NUM_LIT:100> ) <EOL> Heartbeat ( ) </s>
