diff options
author | ars <asav1410@gmail.com> | 2020-06-17 15:59:52 +0100 |
---|---|---|
committer | ars <asav1410@gmail.com> | 2020-06-17 15:59:52 +0100 |
commit | f665f78155047838dc924634ebe4128f7add5542 (patch) | |
tree | fa0b6d2fd4a7b26d7fac2d557066044384d33010 /dev_scripts/sen15901vanelive.py |
Diffstat (limited to 'dev_scripts/sen15901vanelive.py')
-rw-r--r-- | dev_scripts/sen15901vanelive.py | 31 |
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) |