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

Why can I not just listen for humidity and temperature like I do with accel? #9

Open
danjenkins opened this issue Jun 7, 2016 · 2 comments

Comments

@danjenkins
Copy link

On the accelerometer and ambient light & sound modules, I can just listen for the values as events and they come - I don't have to ask for them. I can't do that here; you have to ask for them

I thought at first it was because it just didn't make sense to do it; but when you think about it, theres no difference between temperature and light levels for example.

Being able to do things the same way across all the modules would be great, right now, I have to write a loop which picks up the value every x milliseconds

@johnnyman727
Copy link
Contributor

The short answer is because they were written by different authors at different times but there is no reason why we can't add it to this API.

The accelerometer chip actually pulls an interrupt line low when it has a new sensor reading available so an event-based system makes sense there. The ambient module just uses setTimeout with a timeout value that's available to users of the API. The latter probably makes the most sense here.

@Frijol
Copy link
Member

Frijol commented Jun 16, 2016

You're right, we should be able to do that. Good fodder for a PR ;)

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

3 participants