Hi I have a range of infrared sensors up to 10 that I need to read from and accurately time there on and off times so using the registers instead of digitalRead is the most accurate way to get the timing I need.
I most importantly need to determine which sensor I am reading from however reading the registers seems very buggy I have tested with buttons reading pins 2 & 3 having it print out pin 2 or pin 3 but every so often it bugs and says the other pin which I need to overcome.
Yes I have type'd them the wrong round never thought I could confuse people on my own post I did replace those variables as I said but they still flicker between values.
I did replace those variables as I said but they still flicker between values.
What does this mean? What about the test code that you posted(with corrections) does not work the way you intend.
Pull down resistors
Can you please post a sketch of your wiring?
Hi I have a range of infrared sensors up to 10 that I need to read from and accurately time there on and off times so using the registers instead of digitalRead is the most accurate way to get the timing I need.
I'm not certain that using while() loops to time the on/off periods of the multiple sensors will not run into blocking problems. What is the expected on/off periods. How are you planning to record start and stop times with the while() loops.
What have you seen when you poll the sensors in loop() for a state change and record the times. What accuracy do you require and what are you seeing?