-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v0.0.12 firmware - pin.on('change', function(pinVal){}) not always providing pinVal properly #164
Comments
To clarify a bit about this: the issue doesn't appear until a user program tries to observe more than one interrupt pin (set to input). For example: var tessel = require('tessel');
var pinMode = 'pulldown';
tessel.ports.A.pin[2].pull(pinMode);
tessel.ports.A.pin[2].on('change', function(pinVal) {
console.log(pinVal);
}); Is fine:
And... var tessel = require('tessel');
var pinMode = 'pulldown';
[2, 5].forEach(function(pin) {
tessel.ports.A.pin[pin].pull(pinMode);
tessel.ports.A.pin[pin].on('change', function(pinVal) {
console.log(pin, pinVal);
});
}); Is fine...
But, then... var tessel = require('tessel');
[2, 5].forEach(function(pin) {
tessel.ports.A.pin[pin].input();
tessel.ports.A.pin[pin].on('change', function(pinVal) {
console.log(pin, pinVal);
});
}); Has the following result:
|
Something else odd is going on here too? Running the following code: [2, 5].forEach(function(pin) {
tessel.ports.A.pin[pin].pull(pinMode);
tessel.ports.A.pin[pin].on('change', function(pinVal) {
console.log(pin, pinVal);
});
}); Console with both pins 2 & 5 connected to the button:
With pin 2 connected & pin 5 disconnected:
With pin 5 connected & pin 2 disconnected:
|
The simple, single pin example seems to work:
Using external pulldown resistor
Using internal pulldown resistor
pin.pull('pulldown') mode
However, if I try to setup multiple pins at once using an array.forEach loop and, in this case, only have pin 2 connected to the button... pinVal output never changes (always 0 when using pulldown, always 1 when using pullup):
See Related conversation on Slack
The text was updated successfully, but these errors were encountered: