Reply
Highlighted
Regular Member
Posts: 608
Registered: ‎09-17-2013
Kudos: 141
Solutions: 5

debounce input

Not sure if my sensor is faulty, I'm expecting too much from it, or it is drawing more current than the mfi can provide

 

Using a sensor that has a regular output and an inverted output. To insure that the unit is sending the correct signal, I'm ANDing these values. So as long as the sensor is connected and "functioning correctly," this should always be true. However, every now and then the value goes to false.

 

Since all the processing is done within the mfi, I added a delay to "debounce" the inputs. In case there is a change in inputs, I added a loop that is about 100 ms. After which I read the inputs again

 

 

for i in `seq 1 340` #aprox 0.1s
do
	j=$i*$i*$i*$i*$i
done

 

usleep would had done a better job, but not built into the mfi system. I'm using multiply since is take a little longer than addition. However, the delay is a bit nonlinear

Reply