From ca237220430b877e0b395cf25f46550516a98551 Mon Sep 17 00:00:00 2001 From: Brendan Vercoelen Date: Tue, 9 Apr 2024 21:41:19 +1200 Subject: [PATCH] Changed read function to return float of value Fixes #32 Co-Authored-By: scavenrage <22749827+scavenrage@users.noreply.github.com> --- adc/ser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adc/ser.py b/adc/ser.py index c76dd3f..e06b5c1 100644 --- a/adc/ser.py +++ b/adc/ser.py @@ -3,7 +3,7 @@ ADC module for Serial based devices, such as an Arduino -Authors: R41zan, bverc +Authors: R41zan, scavenrage, bverc Requires python module pySerial install: python3 -m pip install pyserial @@ -28,4 +28,4 @@ def read(channel): # pylint: disable=unused-argument """Read from ADC and return voltage.""" ser.reset_input_buffer() # Clear input buffer value_v = ser.readline().decode('utf-8').rstrip() - return value_v + return float(value_v)