Created
April 28, 2016 18:18
-
-
Save uktechreviews/c8c798a44bc556d9bc200b7876905a1a to your computer and use it in GitHub Desktop.
Flotilla Thermometer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import flotilla | |
import time | |
client = flotilla.Client( | |
requires={ | |
'one':flotilla.Matrix, | |
'eight':flotilla.Number, | |
'two':flotilla.Weather | |
}) | |
matrix = client.first(flotilla.Matrix) | |
number = client.first(flotilla.Number) | |
light = client.first(flotilla.Light) | |
weather = client.first(flotilla.Weather) | |
matrix.clear() | |
number.clear() | |
try: | |
while True: | |
time.sleep(0.5) | |
matrix.clear() | |
for y in range(8): | |
matrix.set_pixel(7, y, True) | |
for x in range(8): | |
matrix.set_pixel(x,0, True) | |
try: | |
t_value = int(weather.temperature) | |
print(t_value) | |
number.clear() | |
number.set_number(t_value) | |
number.update() | |
if t_value in range (0,9): | |
m_l_value = 0 | |
if t_value in range (10,19): | |
m_l_value = 1 | |
if t_value in range (20,29): | |
m_l_value = 2 | |
if t_value in range (30,39): | |
m_l_value = 3 | |
if t_value in range (40,49): | |
m_l_value = 4 | |
if t_value in range (50,59): | |
m_l_value = 5 | |
if t_value in range (60,69): | |
m_l_value = 6 | |
if t_value in range (70,79): | |
m_l_value = 7 | |
if t_value in range (80,90): | |
m_l_value = 8 | |
print (m_l_value) | |
for count in range(m_l_value): | |
matrix.set_pixel(3,count+1,True) | |
matrix.set_pixel(4,count+1,True) | |
matrix.update() | |
except Exception: | |
pass | |
except KeyboardInterrupt: | |
client.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment