Skip to content

Commit 4c9301a

Browse files
authored
Merge pull request #8 from kattni/example-update
Variable changes for consistency.
2 parents 3c610de + b65c0e3 commit 4c9301a

File tree

3 files changed

+26
-27
lines changed

3 files changed

+26
-27
lines changed

examples/clue_height_calculator.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@
55
# Set to the sea level pressure in hPa at your location for the most accurate altitude measurement.
66
clue.sea_level_pressure = 1015
77

8-
clue_data = clue.simple_text_display(text_scale=2, colors=(clue.CYAN, 0, clue.RED, clue.RED, 0,
9-
clue.YELLOW, 0, clue.GREEN))
10-
8+
clue_display = clue.simple_text_display(text_scale=2, colors=(clue.CYAN, 0, clue.RED, clue.RED, 0,
9+
clue.YELLOW, 0, clue.GREEN))
1110

1211
initial_height = clue.altitude
1312

14-
clue_data[0].text = "Calculate height!"
15-
clue_data[2].text = "Press A to reset"
16-
clue_data[3].text = "initial height!"
13+
clue_display[0].text = "Calculate height!"
14+
clue_display[2].text = "Press A to reset"
15+
clue_display[3].text = "initial height!"
1716
while True:
1817
if clue.button_a:
1918
initial_height = clue.altitude
2019
clue.pixel.fill((255, 0, 0))
2120
else:
2221
clue.pixel.fill(0)
23-
clue_data[5].text = "Altitude: {:.1f} m".format(clue.altitude)
24-
clue_data[7].text = "Height: {:.1f} m".format(clue.altitude - initial_height)
25-
clue_data.show()
22+
clue_display[5].text = "Altitude: {:.1f} m".format(clue.altitude)
23+
clue_display[7].text = "Height: {:.1f} m".format(clue.altitude - initial_height)
24+
clue_display.show()

examples/clue_spirit_level.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
import displayio
66

77
display = board.DISPLAY
8-
group = displayio.Group(max_size=4)
8+
clue_group = displayio.Group(max_size=4)
99

1010
outer_circle = Circle(120, 120, 119, outline=clue.WHITE)
1111
middle_circle = Circle(120, 120, 75, outline=clue.YELLOW)
1212
inner_circle = Circle(120, 120, 35, outline=clue.GREEN)
13-
group.append(outer_circle)
14-
group.append(middle_circle)
15-
group.append(inner_circle)
13+
clue_group.append(outer_circle)
14+
clue_group.append(middle_circle)
15+
clue_group.append(inner_circle)
1616

1717
x, y, _ = clue.acceleration
1818
bubble_group = displayio.Group(max_size=1)
1919
level_bubble = Circle(int(x + 120), int(y + 120), 20, fill=clue.RED, outline=clue.RED)
2020
bubble_group.append(level_bubble)
2121

22-
group.append(bubble_group)
23-
display.show(group)
22+
clue_group.append(bubble_group)
23+
display.show(clue_group)
2424

2525
while True:
2626
x, y, _ = clue.acceleration

examples/clue_temperature_humidity_monitor.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,34 @@
1212
# Set to true to enable alarm warning.
1313
alarm_enable = False
1414

15-
data = clue.simple_text_display(text_scale=3, colors=(clue.WHITE,))
15+
clue_display = clue.simple_text_display(text_scale=3, colors=(clue.WHITE,))
1616

17-
data[0].text = "Temperature &"
18-
data[1].text = "Humidity"
17+
clue_display[0].text = "Temperature &"
18+
clue_display[1].text = "Humidity"
1919
while True:
2020
alarm = False
2121
temperature = clue.temperature
2222
humidity = clue.humidity
23-
data[3].text = "Temp: {:.1f} C".format(temperature)
24-
data[5].text = "Humi: {:.1f} %".format(humidity)
23+
clue_display[3].text = "Temp: {:.1f} C".format(temperature)
24+
clue_display[5].text = "Humi: {:.1f} %".format(humidity)
2525
if temperature < min_temp:
26-
data[3].color = clue.BLUE
26+
clue_display[3].color = clue.BLUE
2727
alarm = True
2828
elif temperature > max_temp:
29-
data[3].color = clue.RED
29+
clue_display[3].color = clue.RED
3030
alarm = True
3131
else:
32-
data[3].color = clue.WHITE
32+
clue_display[3].color = clue.WHITE
3333

3434
if humidity < min_humidity:
35-
data[5].color = clue.BLUE
35+
clue_display[5].color = clue.BLUE
3636
alarm = True
3737
elif humidity > max_humidity:
38-
data[5].color = clue.RED
38+
clue_display[5].color = clue.RED
3939
alarm = True
4040
else:
41-
data[5].color = clue.WHITE
42-
data.show()
41+
clue_display[5].color = clue.WHITE
42+
clue_display.show()
4343

4444
if alarm and alarm_enable:
4545
clue.start_tone(2000)

0 commit comments

Comments
 (0)