You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to figure out how to read a 10k ohm potentiometer value using an interrupt. My Arduino Uno connections are:
5v VCC -> Pot input
A0 Analog input -> Pot output
GND -> Pot ground
The idea is to use an ADC interrupt handler function to enable a global flag to signal the main loop to read the analog to digital converter value.
ADC function should handle an interrupt when conversion is complete according to docs. Then should I read the value from the register instead of doing an analog_read()?
When I run this code, I can see voltage band gap, ground and temperature values printed. Which means ADC works. But I can't see any a0 value printed and ADC() interrupt handler function seems not getting fired at all.
When I poll the a0 input instead of interrupt I can see the values printed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
Trying to figure out how to read a 10k ohm potentiometer value using an interrupt. My Arduino Uno connections are:
5v VCC -> Pot input
A0 Analog input -> Pot output
GND -> Pot ground
The idea is to use an
ADC
interrupt handler function to enable a global flag to signal the main loop to read the analog to digital converter value.ADC function should handle an interrupt when conversion is complete according to docs. Then should I read the value from the register instead of doing an
analog_read()
?The code I'm trying for that is:
When I run this code, I can see voltage band gap, ground and temperature values printed. Which means ADC works. But I can't see any
a0
value printed andADC()
interrupt handler function seems not getting fired at all.When I poll the
a0
input instead of interrupt I can see the values printed.What am I missing here? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions