I have 3 prox sensors to monitor a chain stretch. Each chain has 47 pins which are going to trigger my sensors as they pass by. I also have 1 extra pin which i’m using as a zero flag( this pin is not in the way of the other 47 pins). 2 of the prox sensors are placed across from each other and I want my program to run in a way that , the program does not start to run until the zero flag prox is triggered. I also want the program to give me the times between 1 zero flag trigger and the next so I can know the chain revolution. I also want the program to record the times between the triggers of the two other prox sensors for the 47 pins simultaneous and restart from 1 whenever the zero flag sensor is triggered. This way, with time, the time differences between the two prox will tell me which of the two chains is stretching. I used pulseIn and I could not get good results. any help is very much appreciated.
Thanks in Advance.
I have attached my code below and the results I got for the first test but the pulse1 and pulse2 which are the time differences for triggers between prox1 and prox 2 are weird numbers at some places. Also the serial monitor does not stop displaying data when the chain stops running.
slatskewtest_int_and_pulsein.ino (2.48 KB)
test for slat skew.txt (311 KB)