Hya,
i was using Monitor GPIO and also had this GPIO defined in a virtual button under devices, and while testing, results where weird, and i finally removed the Monitor GPIO and all worked like a charm.
Is there any incompatibility with GPIO monitoring when this GPIO is being used (define) in a device?
Which is the main purpose of Monitor GPIO? verifying the state when this GPIO is not defined under devices?
Thx in advance for any explanation.
Monitor GPIO - question
Moderators: grovkillen, Stuntteam, TD-er
Re: Monitor GPIO - question
Hmm I may need a bit more info on what's "weird" and how you're using it.
The reason to use the monitor command is to get events when the state of a monitored pin has changed.
Handling events does take quite some resources, so you should not do it on any pin by default.
The reason to use the monitor command is to get events when the state of a monitored pin has changed.
Handling events does take quite some resources, so you should not do it on any pin by default.
Re: Monitor GPIO - question
on the following code i had Monitor GPIO,4
The result was that gpio 04 never had a constat behavior, and with MM on GND and GPIO 4, i never had the voltage.
Please note the GPIO 04 is the VACC device.
When i commented out the Monitor, it worked like a charm. That's why i asked, it monitoring a gpio defined on a device can cause weird behavior.
Code: Select all
On System#Boot do
// GPIO,2,0 // status led - inversed - 1 OFF, 0 ON
// Monitor GPIO,4 // D2
timerSet,1,5
gpio,12,0
gpio,13,0
gpio,14,0
let,1,0
let,2,1
endon
on MQTT#Connected do
event,publishstatus
endon
// loop
// events triggered by http
On B58 do // B58 - gpio 14 - D5
pulse,14,1,500
pulse,2,1,500
let,1,1
Publish,%sysname%/B58/status,0
endon
On B24 do // B24 - gpio 12 - D6
pulse,12,1,500
pulse,2,1,500
let,1,1
Publish,%sysname%/B24/status,0
endon
On BOFF do // BOFF - gpio 13 - D7
pulse,13,1,500
pulse,2,1,500
Publish,%sysname%/BOFF/status,0
let,1,2
endon
// events triggered by MQTT
on MQTTIN#BOFF do // cancelled
if %eventvalue%=1
logentry,"mqt boff"
pulse,13,1,500
pulse,2,1,500
Publish,%sysname%/BOFF/status,0
let,1,2
endif
endon
on MQTTIN#B58 do // brew 5-8
if %eventvalue%=1
logentry,"mqt b58"
pulse,14,1,500
pulse,2,1,500
Publish,%sysname%/B58/status,0
let,1,1
endif
endon
on MQTTIN#B24 do // brew 2-4
if %eventvalue%=1
logentry,"mqt b24"
pulse,12,1,500
pulse,2,1,500
Publish,%sysname%/B24/status,0
let,1,1
endif
endon
on VACC#status do
if %eventvalue%=1 // status = 1
if %v1%=1 // status = 1 var1 = 1
logentry,"Working"
gpio,2,1 // led on
Publish,%sysname%/Notify/status,1 // working
endif
else // status = 0
if %v1%=1 // status = 0 var1 =1
let,1,0
logentry,"Finished"
gpio,2,0 // led off
Publish,%sysname%/Notify/status,0 // finished
endif
if %v1%=2 // status = 0 var1 =2
let,1,0
logentry,"Cancelled"
gpio,2,0 // led off
Publish,%sysname%/Notify/status,2 // cancelled
endif
endif
endon
Please note the GPIO 04 is the VACC device.
When i commented out the Monitor, it worked like a charm. That's why i asked, it monitoring a gpio defined on a device can cause weird behavior.
Re: Monitor GPIO - question
So you have the switch task + monitoring for GPIO 4?
There is no need for monitoring on that pin if you also have a switch task configured as the switch task will generate events on its own on changes.
I am not sure why it was not working, maybe the extra event handling interfered with the speed needed for the switch task?
There is no need for monitoring on that pin if you also have a switch task configured as the switch task will generate events on its own on changes.
I am not sure why it was not working, maybe the extra event handling interfered with the speed needed for the switch task?
Re: Monitor GPIO - question
seams not being a good idea.. learned the hard way
Who is online
Users browsing this forum: Bing [Bot] and 143 guests