if __name__ == "__main__": #Initialize lcd and test screen lcd = Lcd() #Init Logger logger = Logger("PF3I0333ITSWQ97W") #Get all sensor name subdir = get_immediate_subdirectories("/sys/bus/w1/devices") temperatureSensor = [] for dir in subdir: if(dir != "w1_bus_master1"): temperatureSensor.append(TemperatureSensor(dir)) while(1): #display sensor temperature lcd.lcd_string(temperatureSensor[0].read(),1) lcd.lcd_string(temperatureSensor[1].read(),2) #Update push data in api for each sensor #We have to push to thingspeek and local database logger.write(temperatureSensor[0].read(),"field1") logger.write(temperatureSensor[1].read(),"field2") #if we have to control temperature #If we have new sensor ask for name description and add to api #Display data on lcd screen #Check current profil data #if bad temperature Work on fridge temperature #Be carefull to anticipate temperature limit print("waiting") time.sleep(10)
# begin attendance session readCards(course, lecture) # inform user that the system is ready to shut down lcd.lcd_string('Ready to', lcd.LCD_LINE_1) lcd.lcd_string('shut down!', lcd.LCD_LINE_2) if __name__ == '__main__': try: timeout = 300 uptime = 0 delay = 5 try: code = urllib2.urlopen(BASE_URL + 'test').getcode() except urllib2.URLError, err: code = 0 while (code != 200): lcd.lcd_string('Initializing', lcd.LCD_LINE_1) lcd.lcd_string('Local Network...', lcd.LCD_LINE_2) time.sleep(delay) # 3 second delay uptime+=delay try: code = urllib2.urlopen(BASE_URL + 'test').getcode() except urllib2.URLError, err: pass if uptime >= timeout: lcd.lcd_string('Timedout waiting', lcd.LCD_LINE_1) except: pass