Analog to Digital Conversion
Hooking Things Up Backward
What happens if you connect an analog sensor to a regular (digital) pin? Nothing bad will happen. You just won’t be able to do an analogRead successfully:
int x = analogRead(8); //Try to read the analog value on digital pin 8 - this doesn’t work!
This will compile but x will be filled with a nonsensical value.
What happens if I connect a digital sensor to an analog pin? Again, you will not break anything. If you do an analog-to-digital conversion on a button, you will most likely see ADC values very close to 1023 (or 5V which is binary 1) or very close to 0 (or 0V which is binary 0).