Closed blalor closed 10 years ago
It also appears that the value of the pin is only read once, instead of periodically or updated via an interrupt.
Let me take a look into this and I willl get back to you.
I'm getting similar results with a Spark Core. I've connected a button following the diagram in the Cylon button docs (http://cylonjs.com/documentation/drivers/button/). The 'push' event will fire once after holding the button down for a second or two, but 'release' never happens.
At first I thought it was faulty wiring, but I tested using the Tinker iOS app which would accurately report HIGH for a digitalRead when the button was depressed.
Also, looking at the button code, it appears that isPressed
is a primitive boolean rather than a function that returns a boolean.
There was a major new release of Cylon.js at the end of last week. @ericterpstra are you still having this problem?
@blalor this has been fixed for digispark and will be released shortly in the next npm module release. In the meantime you can give it a try from the repo here:
https://github.com/hybridgroup/cylon-gpio/tree/development
That's the dev branch, you are now able to define an interval for the connection, the reads from the input will be read at the interval specified.
This is an example for the button:
https://github.com/hybridgroup/cylon-digispark/blob/development/examples/button/button.js
@deadprogram I just tried the dev branch from @edgarsilva and it appears to be working as expected now. Thanks!
@ericterpstra great! I'll merge into master and cut a release of the NPM module this week and update here. Feel free to close the issue or wait for the npm module release :+1:
This has should be solved already, closing the issue.
There are a couple of issues with the Button driver. I'm using the
digispark
connection, but I don't think this problem is specific to that connector.From the example here:
push
event is never fired; I'd expect that it be triggered whenever the pin changes levelButton#isPressed
causes a stack trace: