Are there plans to extend setWatch() to allow reacting to an analog input value? Does the chip the Espruino uses even have a good way to do that? Or is it better to wire up something to convert that event into a digital pulse and set a watch on that?
For example, to put a watch on the results of an analog sensor, so if it went over a certain value, it'd call the function? (This is easy enough to handle w/discrete components - a '339 and a pair of dividing resistors to make a reference can handle detecting if it's above or below a threshold)
Or to use one of those ultra-cheap chinese "vibration sensors" to detect shocks? (the 20 cent ones that look kinda like blue resistors. When tapped or shaken, the resistance changes randomly). This I think could also be used with a 339 to get a digital output from it in the event of changes.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Are there plans to extend setWatch() to allow reacting to an analog input value? Does the chip the Espruino uses even have a good way to do that? Or is it better to wire up something to convert that event into a digital pulse and set a watch on that?
For example, to put a watch on the results of an analog sensor, so if it went over a certain value, it'd call the function? (This is easy enough to handle w/discrete components - a '339 and a pair of dividing resistors to make a reference can handle detecting if it's above or below a threshold)
Or to use one of those ultra-cheap chinese "vibration sensors" to detect shocks? (the 20 cent ones that look kinda like blue resistors. When tapped or shaken, the resistance changes randomly). This I think could also be used with a 339 to get a digital output from it in the event of changes.