def oled_init(ox=128, oy=64, runTest = True): printTitle("oled_init()") from util.oled import Oled from util.display_segment import threeDigits sleep_ms(1000) oled = Oled(i2c, ox, oy) print("test oled display: OK") if runTest: oled.test() threeDigits(oled,123) return oled
# octopusLAB example - 2019 # simple example: dallas thermometer and oled display from time import sleep from util.octopus import oled_init from util.iot import Thermometer from util.display_segment import threeDigits print("init > ") ts = Thermometer() oled = oled_init() print("start > ") while True: temp = ts.get_temp() print(temp) temp10 = int(temp * 10) threeDigits(oled, temp10, True, True) sleep(1)
def tempDisplay(temp): tw = int(temp * 10) # print("T({0}): {1}".format(bytearrayToHexString(t), str(tw/10))) if isOLED: threeDigits(oled, tw, True, True)