Charging and discharging an electroscope