arduino and multipel analog inputs


can Arduino accept various analog inputs (sensors, pots, ultrasound sensors, etc) using the same code…?

…or each input should be programmmed differently in order to accept specific inputs?

in other words, can I programm Arduino so as the 1st analog input can accept either a pot or a sensor or an accelerometer
or whatever??


If i understand your question correct, you want to swap sensors / input devices on the fly ?

It cold be possible, but only if the sensors / input devices act in the same way. Analog input read resistive devices like potentiometers, or devices that send out a voltage between 0 and 5 volts.

Some sensors are read in a different way.

If all your sensors are in the first group, then technically you coild swap the on the fly, but there would probably be issues with sacling amd converting the input.


Hi MikMo,

do you any input devices that are read in a different way?

As far as I’m concerned most sensors and potensiometers send a 0-5V voltage?
am I missing something??


There are plenty of things like temp sensors which run off the I2C bus which uses a digital signal instead of analog.