Im relatively new to the Arduino im trying to create a Sound localization with 4 Microphones. Those Microphones are attached to the 4 cornors of an Target. Now is my Problem i want to know the time difference between these Microphones but they can be at the same moment so i need to check every Microphone simultaneously. Does anybody know how to check 4 inputs simultaneously.?
Use pins in the same I/O port and read the PINx register for that port.
What model Ardiuno are you using? On an Arduino with an ATmegs328p processor, like an UNO, Nano, or Mini, pins 0 through 7 can be read simultaneously from PIND and pins 8 through 13 can be read simultaneously from PINB.
I would use pins 8, 9, 10, and 11. Read PINB as often as possible and look for the first signal. Then store that byte and the next N subsequent values in a buffer. Based on how fast you can read and store PINB you can figure out how many samples you need.
4 digital inputs, but not 4 analog inputs.
thank you for your Answer. Im using an Arduino Mega at the moment but i also have an arduino uno.
I will try your idea and hopefully it works.