Arduino code for a microgrid system