Skip to content

Commit 56c194d

Browse files
authored
Add files via upload
1 parent 64f8391 commit 56c194d

File tree

1 file changed

+3
-4
lines changed
  • Weather Station (AHT20 + BMP280)

1 file changed

+3
-4
lines changed

Weather Station (AHT20 + BMP280)/main.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from pyb import LED
21
from machine import Pin, I2C
32
from AHT20 import AHT20
43
from BMP280 import BMP280
@@ -62,7 +61,7 @@ def screen_2_graphics(value):
6261
tft.ellipse(60, 80, 44, 44, tft.WHITE)
6362
tft.ellipse(60, 80, 40, 40, tft.WHITE)
6463

65-
dial = contrain(value, 0, 100)
64+
dial = constrain(value, 0, 100)
6665
line = map_value(dial, 0, 100, -2.618, 2.618)
6766
tft.line(60, 80, (60 + int(36 * math.sin(line))), int(80 - (36 * math.cos(line))), tft.YELLOW)
6867
tft.line(60, 80, (60 - int(10 * math.sin(line))), int(80 + (10 * math.cos(line))), tft.YELLOW)
@@ -93,7 +92,7 @@ def screen_3_graphics(value):
9392
tft.text("900", 138, 108, tft.BLACK)
9493
tft.text("1100", 194, 108, tft.BLACK)
9594

96-
temp = contrain(value, 300, 1200)
95+
temp = constrain(value, 300, 1200)
9796
temp = int(map_value(temp, 300, 1200, 10, 230))
9897
tft.line(temp, 95, (temp - 4), 90, tft.WHITE)
9998
tft.line(temp, 95, (temp + 4), 90, tft.WHITE)
@@ -109,7 +108,7 @@ def map_value(v, x_min, x_max, y_min, y_max):
109108
return int(y_min + (((y_max - y_min)/(x_max - x_min)) * (v - x_min)))
110109

111110

112-
def contrain(value, min_value, max_value):
111+
def constrain(value, min_value, max_value):
113112
if(value > max_value):
114113
return max_value
115114

0 commit comments

Comments
 (0)