you obviously did not read my post and understand it, you
can't have both these lines set.
Code: Select all
# for the alarm to cycle while ever the sensor input is high un-coment the line below
alarm = 0
# for the alarm to only sound once while ever the sensor input is high un-coment the lines below
alarm = GPIO.input(4)
count = count + 1
how simple does it have to be, these are the 2 options choose which one you want to use.
you either use it like this
Code: Select all
# for the alarm to cycle while ever the sensor input is high un-coment the line below
#alarm = 0
# for the alarm to only sound once while ever the sensor input is high un-coment the lines below
alarm = GPIO.input(4)
count = count + 1
or you use it like this
Code: Select all
# for the alarm to cycle while ever the sensor input is high un-coment the line below
alarm = 0
# for the alarm to only sound once while ever the sensor input is high un-coment the lines below
#alarm = GPIO.input(4)
#count = count + 1
Note the different # placings
and finally the code works when tested with a switch if you sensor is high all the time then no it will never reset, I suggest you test your sensor it see if it ever goes low.