Oct-30-2020, 01:55 AM
Hello , guys
i am new using python i would like to send a package of hexadecimal values using the uart the problem it is two of the values are variables i have done a lot of research and i cant find anything it will be really helpful here is my code basically i am trying to send this
i am new using python i would like to send a package of hexadecimal values using the uart the problem it is two of the values are variables i have done a lot of research and i cant find anything it will be really helpful here is my code basically i am trying to send this
Output:x = b'\x41\x0A\x01\variable\variable'contition=True
while contition:
main_input = int(input("select a number: "))
if main_input == 13:
contition == False
break
elif main_input == 1:
light_val = int(input("insert the new threshold value: "))
a = (1, 10, light_val)
csum = sum(a)
csum = hex( csum^ 0xFF)
print(csum)
b = hex(light_val)
c = hex(10)
d = hex(1)
e = hex(65)
y = (e, c, d, b, csum)
x = b'\x41\x0A\x01\x05\EF'
#ser.write(x)
#ser.write(Y)
print(Y)
else:
print(" Not Valid choice")thanks a lot