I am getting my feet wet with webCore and loving it. One of my uses is announcements for doors and our baby gate. Our son is lovingly dubbed “T Rex” and the piston below is to alert us to his movements at the top of the stairs.
My questions are:
-
Should I have a local variable equal to a global variable for mere readability/update-ability of the code? I am somewhat torn between doing so and trying to trim things down as much as possible. In my mind this makes the code cleaner and easier to update but there must be a resource cost. Is it negligible?
-
I have an architecture issue with my code… If the sensor has an acceleration event while the gate is open, which I’d like to ignore, I am getting the status unknown message. To address that I blank out the Message variable in the instance I am posting (not tested) but there has to be a better way that doesn’t complicate things with more IFs. The architecture of this code is a subset of what I use for my Door Announcements that I will post in another thread due to some “Cancelling” issues I am having. The reason for the IFs to set the message and then separately playing the message is due to the door piston having 6 possible statuses… not much reason for it here but I would like to reuse code if possible.
Just a note - the Volume variable is used in “Speak Text”. I am using Speak Text with restore (not sure that restore does) as the regular Speak Text quit speaking after a few tests. The restore variant works more reliably.