Initialize analog input pin.
Improve logic for Ch7 switching.