def readLight(): global light try: light = bh1750fvidriver.readLight() return True except: return False
def update_light(*args): global timer_running, light try: if not timer_running: return False count = 0 while True: light = bh1750fvidriver.readLight() print getNowStr() + "Intenzita osvětlení "+str(light) + " lux" lcd_display_string("Intenzita osvětlení "+str(light)+" % ", 2) if light: break count += 1 if count>10: print getNowStr() + "Intenzita osvětlení - neúspěšné měření" break time.sleep(1) except: return timer_running
def readLight(): global light try: light = bh1750fvidriver.readLight() except: pass