Reply
Highlighted
Regular Member
Posts: 609
Registered: ‎09-17-2013
Kudos: 143
Solutions: 5

reading fast changing signal

[ Edited ]

Been trying to read a signal that should be high, but drops every 12s for about 20µs. I was able to read it some times, but not very consistently. The signal drops in one of the inputs and a few seconds later on the other. It is sort of a heartbeat, to indicate that the system is working.

 

In order to know that the device triggered, both inputs need to be low. So ignoring the heartbeat would be easy enough. However,  would be nice to be able to know everything is working correctly. I wonder if there is an interrupt, a latching input on value change, etc.

 

The code I been testing is

#!/bin/sh

while true; do

	in1="cat /proc/gpio/io18"
	in2="cat /proc/gpio/io19"
	in3=$(($in1 && $in2))


	if [ $in1 = 0 ] && [ $in2 = 1 ]
	then
		echo "1 low"

	fi

	if [ $in1 = 1 ] && [ $in2 = 0 ]
	then
		echo "2 low"

	fi

	if [ $in1 = 0 ] && [ $in2 = 0 ]
	then
		echo "open"
	fi

done

 

Reply