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
Larz60+ write Oct-30-2020, 02:33 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
fixed for you this time. Please use tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
fixed for you this time. Please use tags on future posts.