tempDecimal = 300
if tempDecimal > 255:
dig1 = tempDecimal // 256
dig2 = tempDecimal % 256
else:
dig1 = 0
dig2 = tempDecimal
dig = (str(dig1) + str(dig2))
# Build hex byte string
hex_str = bytes([dig1, dig2]).hex()
print(hex_str)
tempBytes = bytearray.fromhex(hex_str)
print(tempBytes)
dig1 and dig2 are added as ascii instead of hex
I have been trying for days