The serial port program attempted to print the data from the Python Let me show you the code I used.
import serial
import time
ser =serial.Serial(port="COM1",
baudrate=926100,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
timeout=20)
ser.isOpen() ## open port
print ("Sensortag's connected Succesfully!.")
while 1:
res1 =ser.readline()
res3=res1[13:21]
time.sleep(1.0)
if res3 >=250:
print("Sensor has invalid value Please wait a moment.")
elif res3 < 250 & res3>=200:
print("The user's movements are abnormal. Please check.")
else:
print("The user Your movements are normal.")
print(res3)
First of all, what I want is to print numbers in a program and see if they exceed a certain range.But here's the problem.
Traceback (most recent call last):
File "C:\Users\SEOI\AppData\Local\Programs\Python\Python37-32\ㅋㅋㅋㅋ.py", line 37, in <module>
if res3 >=250: ## 3).When UART outputs a value, it outputs the required parts
TypeError: '>=' not supported between instances of 'bytes' and 'int'
In the following questions, you have identified an error because the value i can receive in the program is not numeric
However, it is not possible to know how 'b'
should remove the part from the part that is output from the file
We used sliding to solve the following problem, but 'b'
as shown in the picture has been output.
I'll attach the picture to the printout section of B
mentioned above.
++)I just checked, and I can't see the image of B in the right direction, so I'll leave it in writing.
b'0253.787' b'0261.909' b'0268.000' b'0263.939' b'0261.909' b'0259.878' b'0257.848' b'0255.818' b'0253.787' b'0290.333' b'0282.212' b'0276.121' b'0270.030' b'0265.969' b'0263.939' b'0261.909' b'0259.878' b'0261.909' b'0263.939' b'0261.909' b'0259.878' b'0257.848' b'0255.818' b'0253.787' b'0300.484' b'0485.242' b'0633.454'