summaryrefslogtreecommitdiff
path: root/dev_scripts/sen15901vanelive.py
blob: 1c7c56e015d64a70d63afae48932be5e69457244 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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)