So I’m having an issue with my python code which prevents the code from working.
Whenever I run the script I get the following two items printed:
/usr/local/bin/python3
/Users/username/Library/CloudStorage/OneDrive-Personal/projects/other/projectcode.py
The code does work, as it worked on tuesday, and it’s now thursday with the EXACT SAME CODE and it does not work.
The code is for a pressure sensor
# libraries
import serial
import re
# sensor
serial_port = '/dev/cu.usbserial-10'
baud_rate = 115200
# info
ser = serial.Serial(serial_port, baud_rate) # raw data
# print
try:
while True:
line = ser.readline().decode().strip() # string data
print(line)
except KeyboardInterrupt: # control + c
ser.close()
print("closed port")
Please help!