How to read a digital pin only for x seconds

Hi all

Hope somebody can help me !!

Is it possible to read 3 digital pins for only x amount of seconds after a trigger and then only read it again after the next trigger.

Thanks Wikus

(deleted)

spycatcher2k:
Yes. But why?

Sounds logical ...
Doesn't it?

Regards

I want to digital read 3 pins ,one pin stays high for a long time but the other two goes low after a few min.
but don't care if they go low alter just want to know if they went high after the trigger

Is it possible to read 3 digital pins for only x amount of seconds after a trigger and then only read it again after the next trigger.

Well, you can use an if-statement to read only after a trigger, and you can delay after the trigger (before you read) or you can delay before "allowing" another trigger & read, etc..

But it doesn't quite make sense to read for X-seconds... When you read you'll get 3 instantaneous readings. You can "sample" the pins and read once per second or 100 times per second, etc., but you can't read continuously for X-seconds.

I want to digital read 3 pins ,one pin stays high for a long time but the other two goes low after a few min.
but don't care if they go low alter just want to know if they went high after the trigger

More if statements...

Read in a "fast loop" (no delays) and if Pin2 == 1, then WasHigh2 = 1, etc.

Since you can't use delay(), because you need to be reading those 3 pins as often as possible, you'll have to use millis() for timing

Let me explain more in detail
I have a timer that is set to come on every 6 hours for 30 min. and there are two heaters connected to the timer.
The timer is the trigger and im checking that the heaters are drawing current ,but the heaters have clicksons on them so after some time if the heaters get to +30 deg. then the clicksons switch them off and the timer is still on.

now i want to only read them at start up to make sure they are on and if not to make alarm.

i have done a simple if statement if (digitalRead(timerPin) == HIGH && digitalRead(heater1) == HIGH &&...........

else {digitalWrite (alarm, HIGH)

but sure it works till one heater goes low

I am still learing this all but slowly hopping to get there

thanks for the in put guys.

I got it working fine on a uno But now the problem comes in i wanna shrink it all to a Atiny85 and with only 5 digital pins its got me '

wikus5252:
thanks for the in put guys.

I got it working fine on a uno But now the problem comes in i wanna shrink it all to a Atiny85 and with only 5 digital pins its got me '

In a pinch, you can use the top two thirds of the voltage range as an analog input on the reset pin. If you need more, consider a chip with more pins, like the tiny 84.