I am working on a unit that can handle a variety of sensor like attachments. I have dedicated PINS 4-8 for the sensor inputs. My goal is write 1 class utilizing the functionality of both PIR sensor and Break-Beam sensors. My problem is that I want to be able to interchange the sensors between the PINs as needed. For example, I want to have all the pins be digitalInputs from the beginning. Without dedicating a type of sensor to a particular pin, I want to essentially have a 4 wire harness that I can plug-n-play various quantities of sensors and have the program pick them up. Note: any ‘floating’ pins would be ground when not in use.
I understand that leaving a floating pin is plain stupid, so to fix this I planned to use the internal Pullup. My complication is PIR signals motion via HIGH and the BreakBeam signals “motion” via LOW. If the internal pullup is turned on, the PIR sensor would never be able to be “read” as activating the internal pullup always yields a digitalRead(PIN) => HIGH.
Is there a solution to be able to distinguish the difference between internal pullup and legitimate input?
Perhaps I am foolish thinking I can dynamically swap hardware without telling the program which is which.
Any help is appreciated. Thank you.