How does attaching analog inputs to digital pins actually works?