writing clean microcontroller code