added battery pin and function for battery