import IOboard address = 0x68 IOboard.init(address) LCDhandler = IOboard.initLCD(2, 16, 8) IOboard.writeLCD(LCDhandler, 0, 0, "Hello World")
print("DS1307 = \t\t%s" % DS1307.read_datetime()) print("System Time = \t" + time.strftime("%Y-%m-%d %H:%M:%S")) sendCmd("sensor-update Day " + str(DS1307._read_day())) sendCmd("sensor-update Date " + str(DS1307._read_date())) sendCmd("sensor-update Month " + str(DS1307._read_month())) sendCmd("sensor-update Year " + str(DS1307._read_year())) sendCmd("sensor-update Hour " + str(DS1307._read_hours())) sendCmd("sensor-update Minutes " + str(DS1307._read_minutes())) sendCmd("sensor-update Seconds " + str(DS1307._read_seconds())) if Addons["LCD1602"]: IOboard.clearLCD(LCDhandler) msgL1 = "20" + str(DS1307._read_year()) + "-" + str(DS1307._read_month()) + "-" + str(DS1307._read_date()) msgL2 = str(DS1307._read_hours()) + ":" + str(DS1307._read_minutes()) + ":" + str(DS1307._read_seconds()) IOboard.writeLCD(LCDhandler, 0, 0, msgL1) IOboard.writeLCD(LCDhandler, 0, 1, msgL2) msgL3 = str(int(temperature)) + " 'C" msgL4 = str(int(humidity)) + " RH" IOboard.writeLCD(LCDhandler, 11, 0, msgL3) IOboard.writeLCD(LCDhandler, 11, 1, msgL4) if Addons["UltraSonic"]: distance = calDistance(GPIO_Trigger, GPIO_Echo) print("The distance measurement of UltraSonic: {0}".format(distance)) sendCmd("sensor-update UltraSonic %.2f" % (distance)) if Addons["DHTreader"]: try: temperature, humidity = DHTreader.read(typeDHT, pinDHT) if temperature and humidity:
print("DS1307 = \t\t%s" % DS1307.read_datetime()) print("System Time = \t" + time.strftime("%Y-%m-%d %H:%M:%S")) sendCmd("sensor-update Day " + str(DS1307._read_day())) sendCmd("sensor-update Date " + str(DS1307._read_date())) sendCmd("sensor-update Month " + str(DS1307._read_month())) sendCmd("sensor-update Year " + str(DS1307._read_year())) sendCmd("sensor-update Hour " + str(DS1307._read_hours())) sendCmd("sensor-update Minutes " + str(DS1307._read_minutes())) sendCmd("sensor-update Seconds " + str(DS1307._read_seconds())) if Addons["LCD1602"]: IOboard.clearLCD(LCDhandler) msgL1 = "20" + str(DS1307._read_year()) + "-" + str(DS1307._read_month()) + "-" + str(DS1307._read_date()) msgL2 = str(DS1307._read_hours()) + ":" + str(DS1307._read_minutes()) + ":" + str(DS1307._read_seconds()) IOboard.writeLCD(LCDhandler, 0, 0, msgL1) IOboard.writeLCD(LCDhandler, 0, 1, msgL2) msgL3 = str(int(temperature)) + " 'C" msgL4 = str(int(humidity)) + " RH" IOboard.writeLCD(LCDhandler, 11, 0, msgL3) IOboard.writeLCD(LCDhandler, 11, 1, msgL4) if Addons["UltraSonic"]: distance = calDistance(GPIO_Trigger, GPIO_Echo) print("The distance measurement of UltraSonic: {0}".format(distance)) sendCmd("sensor-update UltraSonic %.2f" % (distance)) if Addons["DHTreader"]: try: temperature, humidity = DHTreader.read(typeDHT, pinDHT) if temperature and humidity: