-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (25 loc) · 665 Bytes
/
main.py
File metadata and controls
33 lines (25 loc) · 665 Bytes
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
from time import sleep
import machine
import BME280
BOOLIAN_FLAG = True
# ESP32 - Pin assignment
i2c = machine.I2C(scl=machine.Pin(22), sda=machine.Pin(21), freq=10000)
pin14 = machine.Pin(14, machine.Pin.OUT)
if (BOOLIAN_FLAG):
high_low_flag = True
else:
high_low_flag = 0x01
bme = BME280.BME280(i2c=i2c)
while True:
if (BOOLIAN_FLAG):
high_low_flag = not high_low_flag
else:
high_low_flag = ~high_low_flag & 0x01
pin14.value(high_low_flag)
temp = bme.temperature
hum = bme.humidity
pres = bme.pressure
print('Temperature: ', temp)
print('Humidity: ', hum)
print('Pressure: ', pres)
sleep(1)