From f665f78155047838dc924634ebe4128f7add5542 Mon Sep 17 00:00:00 2001 From: ars Date: Wed, 17 Jun 2020 15:59:52 +0100 Subject: Initial commit --- dev_scripts/sen15901vanelive.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 dev_scripts/sen15901vanelive.py (limited to 'dev_scripts/sen15901vanelive.py') diff --git a/dev_scripts/sen15901vanelive.py b/dev_scripts/sen15901vanelive.py new file mode 100644 index 0000000..1c7c56e --- /dev/null +++ b/dev_scripts/sen15901vanelive.py @@ -0,0 +1,31 @@ +from gpiozero import MCP3008 +import time +import math + +adc = MCP3008(channel=0) +count = 0 + +# 5K resistor +volts = {1.87: 0.0, + 2.04: 22.5, + 0.79: 45.0, + 0.80: 45.0, + 0.88: 67.5, + 0.13: 90.0, + 0.36: 112.5, + 0.24: 135.0, + 0.62: 157.5, + 0.44: 180.0, + 1.44: 202.5, + 1.27: 225.0, + 2.81: 247.5, + 2.76: 270.0, + 2.91: 292.5, + 2.31: 315.0, + 2.59: 337.5} + + +while True: + wind = round(adc.value*3.3,2) + print(wind) + time.sleep(1) -- cgit v1.2.3