Updated microcontroller code