From da6e1cfa94b8d18e044fe1391c2c0070586c2aee Mon Sep 17 00:00:00 2001 From: Nicholas Pease Date: Tue, 12 Jan 2021 11:11:45 -0500 Subject: [PATCH] Test fixes --- python/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/api.py b/python/api.py index 973a5ec..3983644 100644 --- a/python/api.py +++ b/python/api.py @@ -21,6 +21,7 @@ def readVoltage(bus): read = bus.read_word_data(address, 2) swapped = struct.unpack("H", read))[0] voltage = swapped * 1.25 /1000/16 + print(typeof voltage) return voltage @@ -30,10 +31,11 @@ def readCapacity(bus): read = bus.read_word_data(address, 4) swapped = struct.unpack("H", read))[0] capacity = swapped/256 + print(typeof capacity) return capacity - + @app.route('/battery',methods = ['POST','GET']) -def writeJSON(): +def battery(): capacity = readCapacity(bus) voltage = readVoltage(bus) if GPIO.input(6):