Hi,
I'm trying out my adabox clue and having a good time mostly.
Carter Nelson's CLUE Altimeter is giving me this error on Mu's RELP
Traceback (most recent call last):
File "code.py", line 175, in <module>
File "code.py", line 159, in update_display
ValueError: can't convert NaN to int
I'm using his original code and libraries from the guide.
I cant make heads or tails of it.
I used both 6.0.0-alpha.2 and 5.3.1 UF2 with the 07/28 libraries.
thank you :)
CLUE Altimeter
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- justdreambig
- Posts: 1
- Joined: Mon May 07, 2018 2:28 pm
Re: CLUE Altimeter
I'm trying the same thing and get the same result. I hope someone knows..
Thanks
Thanks
- UncleJosh
- Posts: 12
- Joined: Fri Dec 28, 2018 12:25 am
Re: CLUE Altimeter
I downloaded the code today (August 3 2020) and had to toss a recalibrate() command in front of the for loop.
I think it's because there is no default set for nvm that is imported from microcontroller. Once I ran through a calibration, I was able to run the code multiple times to find things work.
I think it's because there is no default set for nvm that is imported from microcontroller. Once I ran through a calibration, I was able to run the code multiple times to find things work.
- adafruit_support_carter
- Posts: 29473
- Joined: Tue Nov 29, 2016 2:45 pm
Re: CLUE Altimeter
Ack! Yah, that could be a bug. On first run the value read from NVM will likely be garbage.
Try this. Replace the code near the top (look for the comment line) with this:
Try this. Replace the code near the top (look for the comment line) with this:
Code: Select all
# restore saved sea level pressure from NVM
try:
clue.sea_level_pressure = struct.unpack("f", nvm[0:4])[0]
except ValueError:
clue.sea_level_pressure = STD_SLP
- unawoo
- Posts: 114
- Joined: Thu Apr 14, 2016 9:39 pm
Re: CLUE Altimeter
Hi Carter,
tried the code but i get a syntax error on line 34.
i tried all combinations of indent , it's all the same.
tried the code but i get a syntax error on line 34.
i tried all combinations of indent , it's all the same.
- adafruit_support_carter
- Posts: 29473
- Joined: Tue Nov 29, 2016 2:45 pm
Re: CLUE Altimeter
@unawoo Apologies. I should have tested that further. I see why that didn't work now. Try this instead:
Code: Select all
# restore saved sea level pressure from NVM
slp = struct.unpack("f", nvm[0:4])[0]
clue.sea_level_pressure = slp if 0 < slp < 2000 else STD_SLP
- unawoo
- Posts: 114
- Joined: Thu Apr 14, 2016 9:39 pm
Re: CLUE Altimeter
Thank you Carter, that did it.
- adafruit_support_carter
- Posts: 29473
- Joined: Tue Nov 29, 2016 2:45 pm
Re: CLUE Altimeter
Cool. Thanks for confirming. I made a PR with those fixes:
https://github.com/adafruit/Adafruit_Le ... /pull/1201
So if that gets merged, the guide will automatically update to the new code.
Sorry again about that. Silly mistake to not have dealt with that better.
https://github.com/adafruit/Adafruit_Le ... /pull/1201
So if that gets merged, the guide will automatically update to the new code.
Sorry again about that. Silly mistake to not have dealt with that better.
- unawoo
- Posts: 114
- Joined: Thu Apr 14, 2016 9:39 pm
Re: CLUE Altimeter
noting silly about it.
i looked up NaN, wtf not a number, and tough that you would figure it out way way before i would.
thank you for doing what your doing, you are appreciated.
i looked up NaN, wtf not a number, and tough that you would figure it out way way before i would.
thank you for doing what your doing, you are appreciated.
Please be positive and constructive with your questions and comments.