-
Notifications
You must be signed in to change notification settings - Fork 10
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
python3 support for scd30.py, wiring example, root comment for installing clock stretching and more Readme. #3
base: master
Are you sure you want to change the base?
Conversation
float_T = struct.unpack('>f', struct_T) | ||
|
||
struct_rH = struct.pack('>BBBB', data[12], data[13], data[15], data[16]) | ||
float_rH = struct.unpack('>f', struct_rH)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you add [0] for float_co2 and float_rH, but not for float_T - is there any difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will test, but I think it was because the co2 and rh returned a list while the temperature returned a single value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm - the data format is exactly the same for all three... and struct.unpack('>f', ... ) should return a single float every time...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that makes sense, I will have time to test today and will put the output of the code here later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should definitely be a [0] for temperature as well, you are right :)
struct_co2 = struct.pack('>BBBB', data[0], data[1], data[3], data[4])
float_co2 = struct.unpack('>f', struct_co2)[0]
struct_T = struct.pack('>BBBB', data[6], data[7], data[9], data[10])
float_T = struct.unpack('>f', struct_T)[0]
struct_rH = struct.pack('>BBBB', data[12], data[13], data[15], data[16])
float_rH = struct.unpack('>f', struct_rH)[0]
that is the correct way to do it.
No description provided.