.-----.-----.-----.-----.-----.----------< 5V | | | | | | R1 R2 R3 R4 R5 R6 | | | | | | . . . . . . / / / / / / . . . . . . | | | | | | .-----.-----.-----.-----.-----.-.------.-> Gnd | | | | | Interrupt pin Analog pin
The way you have drawn it up here, it looks like you are shorting the 5 volts through some resistor while trying to measure GND with an analog input and the interrupt pin.That will never work.Instead you can add another resistor between the analog pin and GND.You'll create a voltage divider that way, and now you can actually read voltages using your analog input.
Retrolefty has offered you a gem, setting a fixed interrupt that you can use to acquire the analog value and any changes in that.That interrupt doesn't need to be triggered by an external event, so it wil save you an input as well.Of course you might have to take in consideration that this also uses some time.So if your sketch has some dependance on timing, you should check that out.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16