Attiny AVR programmig for project

Hi everyone.
I need to do one project on attiny.
Project description is when on input comes 2 or 3 impulses in 4 seconds then timeout 2 seconds, where in the timeout has no impulses then activate out to activate the relay thru transistor or mosfet gate. When on input comes 1 or 4 impulses in 5 seconds then timeout 2 seconds where in the timeout has no impulses then deactivate out. How I can programmed this.

The logical description is incomplete and collides (in the current state). What starts your time period?

My idea is to do automatic switch. I have alarm, these alarm output to horn(with plus). When alarm is arming horn got 1 impuls, arming without sensors 4 impulses. When disarming goes 2 impulses, without sensors 3 impulses. These timeout 2 seconds need for condition when alarm is activate.
My idea that period starts in every time when avr get the first impuls, is the star of counting.

It sounds a bit garbled but in principle you are controlling a relay via a microcontroller and transistor.
The state of the relay is determined by the number of pulses delivered to the microcontroller within a certain time window.
I can't see the relationship between the timeout and the relay though.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.