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

Possible issue with temperature readings #13

Open
rossb93 opened this issue Mar 19, 2015 · 1 comment
Open

Possible issue with temperature readings #13

rossb93 opened this issue Mar 19, 2015 · 1 comment

Comments

@rossb93
Copy link

rossb93 commented Mar 19, 2015

I was testing my bean within a fridge and when the temperature fell to 0 it seems the reading overflows and hits 255 instead of showing a negative representation. This was done using the temp request function within bean.js just as was done in the examples.

screen shot 2015-03-19 at 09 45 06

@aguerrieri
Copy link

That's the expected behavior. getTemperature returns an int8_t, which is a signed 8-bit integer which can represent numbers from -127 to 128 (which suffices, considering the bean can report temperatures from -40C to 88C). The negative numbers are represented in the "upper half" of the 0-255 range, adding the negative number to 256. In other words, 255 is -1 (256 - 1), 254 is -2 (256 - 2), etc.

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