Hello
I implemented same MQ-7 for CO detection.
I've set a rule for managing heating/measurements/calibration
The idea is to be able to launch the calibration during 48 when pressing the button GPIO4 or to stop it by pressing again.
I use a dummy variable "Calibration_MQ7" that is 1 if calibration is on, and 0 if off...
By pressing the push switch, I shgall inverese the state of this variable
I shall be stupid because it does not work...
( the others timers for heating/measuring are ok)
any idea ?
Thank you
Thomas
Code: Select all
on System#Boot do
timerSet,1,5
taskvalueset 8,1,0 // état calibration à 0
endon
on [MQ7_Calibration_Start-Stop#etat]=1 do //switch pressed
if [Calibration_MQ7#etat]=1
TaskValueSet 8,1,0 // inverse state + stop calibration
gpio,13,0
timerSet,4,0
else
TaskValueSet 8,1,1 // inverse state + start calibration
gpio,13,1 //power on heating
timerSet,2,0
timerSet,3,0
timerSet,4,172800 // Calibrate 48h
gpio,13,0 //stop heating
endif
endon
on Rules#Timer=1 do
gpio,13,1
timerSet,2,60
endon
on Rules#Timer=2 do
gpio,13,0
timerSet,3,45
endon
on Rules#Timer=3 do
TaskValueSet 7,1, [Mesure_MQ7_CO#Analog]
timerSet,1,45
endon
and how I configure the switch to launch calibration (this is a push button, normally closed, between GND & GPIO4):