summaryrefslogtreecommitdiff
path: root/dev_scripts/sen15901vanelive.py
diff options
context:
space:
mode:
authorars <asav1410@gmail.com>2020-06-17 15:59:52 +0100
committerars <asav1410@gmail.com>2020-06-17 15:59:52 +0100
commitf665f78155047838dc924634ebe4128f7add5542 (patch)
treefa0b6d2fd4a7b26d7fac2d557066044384d33010 /dev_scripts/sen15901vanelive.py
Initial commitHEADmaster
Diffstat (limited to 'dev_scripts/sen15901vanelive.py')
-rw-r--r--dev_scripts/sen15901vanelive.py31
1 files changed, 31 insertions, 0 deletions
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)