Skip to content
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

watching/polling not working anymore #26

Closed
sonnyp opened this issue Sep 18, 2014 · 3 comments
Closed

watching/polling not working anymore #26

sonnyp opened this issue Sep 18, 2014 · 3 comments

Comments

@sonnyp
Copy link

sonnyp commented Sep 18, 2014

I have no idea what's going on, it worked perfectly before.
I can read a GPIO but watching doesn't work and no error is thrown.
I can see via gpio utility that the value of the GPIO changed but onoff won't execute my watch callback.

Any idea?

Arch Linux

3.12.28-1-ARCH
@fivdi
Copy link
Owner

fivdi commented Sep 18, 2014

Can you post an simple example that can be used to reproduce the issue please?

@sonnyp
Copy link
Author

sonnyp commented Sep 19, 2014

Reproduced on 3.12.26-1-ARCH

'use strict';

var onoff = require('onoff');

var pin = 25;

var pio = new onoff.Gpio(pin, 'in');
pio.watch(function(err, v) {
  if (err)
    throw err;

  console.log('watch', v);
});

pio.read(function(err, v) {
  if (err)
    throw err;

  console.log('read', v);
});

setInterval(function() {
  console.log('read', pio.readSync());
}, 1000);

process.on('SIGINT', function() {
  pio.unexport();
  process.exit();
});

I'm using a simple obstacle sensor on pin 25.
I run the script and put my hand in front of the obstacle sensor.
The setInterval shows different value. The watch callback is never triggered.

@sonnyp
Copy link
Author

sonnyp commented Sep 19, 2014

Jeez I forgot to add the edge parameter -_-
Sorry.

@sonnyp sonnyp closed this as completed Sep 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants