-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
41 lines (31 loc) · 1.05 KB
/
main.py
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
32
33
34
35
36
37
38
39
40
41
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def wind(speed):
"""Define the wind speed routine"""
from gpiozero import Button
wind_speed_sensor = Button(5)
wind_count = 0
def spin():
global wind_count
wind_count =+ 1
return wind_count
def thp():
import bme280
import smbus2
from time import sleep
port = 1
address = 0x77
bus = smbus2.SMBus(port)
bme280.load.calibration_params(bus,address)
while True
bme280_data = bme280.sample(bus, address)
temperature = randrange(60, 110,0.3) # bme280_data.temperature
humidity = randrange(0, 100.0.3) # bme280_data.humidity
pressure = randrange(60, 100, 0.3) # bme280_data.pressure
sleep(1)
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
thp()
wind(speed)
# See PyCharm help at https://www.jetbrains.com/help/pycharm/