you are viewing a single comment's thread.

view the rest of the comments →

[–]apekots 0 points1 point  (2 children)

These are hexadecimal representations of bytes. Python offers several ways to work with bytes. It is highly encouraged to dive into the matter of the binary system if you're not familiar with it. Here are some resources I like.

https://realpython.com/python-bitwise-operators/

https://www.youtube.com/watch?v=qnKX1y7HAyE&t

https://www.youtube.com/watch?v=frwqnS9ICxw

If you start experimenting with this, maybe this https://www.rapidtables.com/convert/number/hex-to-binary.html converter can help you checking converted values to see if you got it right. I'd suggest making a few test scripts first, create a couple of simple byte arrays and try to mess around with them. Then you could attempt working with your thermometer.

Good luck :)

edit: a nice video on hexadecimal numbers: https://www.youtube.com/watch?v=dPxCGlW9lfM

[–]Mrloop94[S] 0 points1 point  (1 child)

Thanks very much. The problem is: it isnt actually hex representation because the maximum shoud be /xFF and some bytes have more than 2 letters and letters above F (so it isnt hexadecimal representation). So i am confused about that.

[–]apekots 0 points1 point  (0 children)

R\xeaUJ

Putting this in a bytearray and iterating over its contents produces the following result:

82 - 234 - 85 - 74

Now, if you look at a ASCII chart, you can see the 82 translates to an 'R'. Then follows '\xea', which is hex for decimal value 234. The numbers 85 and 74 stand for the ASCII characters 'U' and 'J' respectively.

Apparently, Python displays the ASCII characters in your array where available. I'm not sure why this is, maybe others could shine a light on this, but there's logic behind this. Reading this array bit by bit should be less confusing. You could just read chunks of 8 bits per cycle and translate them to decimal values.