Skip to content

Instantly share code, notes, and snippets.

@uktechreviews
Created April 6, 2016 08:11
Show Gist options
  • Save uktechreviews/f5ecdcc73ed106106acd9d82cf3e0a6d to your computer and use it in GitHub Desktop.
Save uktechreviews/f5ecdcc73ed106106acd9d82cf3e0a6d to your computer and use it in GitHub Desktop.
Flotilla light meter
#!/usr/bin/env python3
import flotilla
import time
client = flotilla.Client(
requires={
'one':flotilla.Matrix,
'two':flotilla.Light,
'eight':flotilla.Number
})
matrix = client.first(flotilla.Matrix)
number = client.first(flotilla.Number)
light = client.first(flotilla.Light)
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)
print (light.data)
try:
l_value = int(light.data[0])
print(l_value)
number.clear()
number.set_number(l_value)
number.update()
if l_value in range (0,99):
m_l_value = 0
if l_value in range (100,199):
m_l_value = 1
if l_value in range (200,299):
m_l_value = 2
if l_value in range (300,399):
m_l_value = 3
if l_value in range (400,499):
m_l_value = 4
if l_value in range (500,599):
m_l_value = 5
if l_value in range (600,699):
m_l_value = 6
if l_value in range (700,799):
m_l_value = 7
if l_value in range (800,5000):
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