Howdy all - I'm working on a project which requires from one to six sensors depending on the dimensions of the space I'm monitoring. I'd like to be able to plug in as many sensors as I need to use without any sort of external action by the user.
If I set the the analog input pin state to low, will this work? Will a simple pulldown resistor work and not affect the reading?
A simple pulldown resistor on the analog inputs will cause analogRead to return zero when you read them, if no sensor is connected, provided that you do not have long wires attached to the inputs pins (because the wires may pick up noise). Whether or not you can distinguish this from a sensor reading depends on whether the sensor ever produces 0V. Whether or not the pulldown resistor will interfere with the sensor reading if it is connected also depends on the type of sensor.
If you are using plugs/connectors, you can make default/dummy plugs, with the pull down resistor, and plug them in any unused analog channel. then if you want to plug in a sensor, just remove the dummy plug, and replace it with a real sensor.