Added flexible LED state function and blinking

also fixed typo in agent code