Arduino code for battery management system