in my project iam measuring temperature,if the value goes above or below certain values alarm is indicated in a file.But this alarm should be shown in a file ,if the alarm set and clear occure more than 3 times in 5 seconds .If the alarm set or clear is less than 3 times in 5 seconds it is not treated as alarm.please help me how to do this.