fix: strip() doesn't work for some reason. do it manually
This commit is contained in:
parent
9e0d995b3f
commit
4cefa3264f
|
@ -7,9 +7,10 @@ app = Flask(__name__)
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def lux():
|
def lux():
|
||||||
ser = serial.Serial('/dev/ttyACM0')
|
ser = serial.Serial('/dev/ttyACM0')
|
||||||
data = ser.readline()
|
# Remove trailing newline (for some reason strip() doesn't work)
|
||||||
|
data = str(ser.readline()).split("\\")[0]
|
||||||
if data:
|
if data:
|
||||||
l = float(data.split("=")[1].strip())
|
l = float(data.split("=")[1])
|
||||||
return str(l)
|
return str(l)
|
||||||
else:
|
else:
|
||||||
return "error"
|
return "error"
|
||||||
|
|
Loading…
Reference in New Issue