def disp_init(config): lcd.hw_init() if (config == lcd.C.LCD_P1 or config == lcd.C.LCDALLPAGE): lcd.page_init(lcd.C.LCD_P1, p1_screen[0], p1_screen[1], p1_screen[2], p1_screen[3]) if (config == lcd.C.LCD_P2 or config == lcd.C.LCDALLPAGE): lcd.page_init(lcd.C.LCD_P2, p2_screen[0], p2_screen[1], p2_screen[2], p2_screen[3]) lcd.two_page_disp()
def main(): print(MAIN_VER) #hook callback function for key event keycallback_config() #adc channel init adc_chan_init() #BLE portion #ble_init() #temperature sensor DS18B20 init ds18b20_init() #LCD display init disp_init(3) lcd.two_page_disp() #thread init thread1 = myThread(1, "Threading-1", 3) print(" thread1 :%s" % thread1) try: thread1.start() except: print("Error: unable to start thread") thread1.join()
print("Volt of channel%s is :%05.3f" % (ch, chVolt[ch])) #BLE portion lookUpNearbyBluetoothDevices() #temperature sensor DS18B20 test GPIO.setup(TEMP_GPIO, GPIO.IN, GPIO.PUD_UP) sensor_temp = 1 while (sensor_temp): try: sensor = W1ThermSensor(W1ThermSensor.THERM_SENSOR_DS18B20, "041702b228ff") temperature = sensor.get_temperature() print("The temperature is %s celsius" % temperature) sensor_temp = 0 except: print("Check pin-BCM4 that is pulled up or not, wait for a minutes") time.sleep(1) #thread init thread1 = myThread(1, "Threading-1", 3) print(" thread1 :%s" % thread1) page_init(3) lcd.two_page_disp() try: thread1.start() except: print("Error: unable to start thread") thread1.join()