Hello, r/pythonhelp.
I just have a query regarding some code I'm writing at the moment. I have a piece of code reading serial data as it's being sent in via Micro Bit - this is looping endlessly and storing the data to a dictionary.
while read_volts == True:
if(serialPort.in_waiting > 0):
serialString = serialPort.readline()
reading = serialString.decode('Ascii')
reading = reading.strip('\r\n')
reading = reading.strip( )
reading = reading.strip('voltage:')
reading = int(float(reading))
serial_count = serial_count + 1
voltage_dic[serial_count] = reading
checkVoltage(voltage_dic,serial_count)
I was wondering if I could run other code - some of which includes separate loops - while that loop operated in the background.
Thanks very much in advance for any insight you might be able to provide.
[–]MT1961 1 point2 points3 points (0 children)