#!/usr/bin/env python """ Test oled package """ import oled import time oled.init(0, 0x3C) # clear whole display test oled.cmdDisplayOFF() for line in range(0, 8): for col in range(0, 128): oled.cmdSetCurPage(line) oled.sendData(0x00) oled.cmdChargePumpEnable() oled.cmdRemapCol(1) oled.cmdRemapRow(1) oled.cmdSetStartRow(0) oled.cmdSetRowOffset(0) oled.cmdDisplayON() oled.cmdSetContrast(255) # test vertical mode with yellow part of display #oled.cmdSetAddrMode(oled.ADDR_MODE_VER) #oled.cmdSetColAddr(0,127) #oled.cmdSetPageAddr(0,1) #oled.sendData(0x00,0x00,0xF8,0x7F,0xFC,0x7F,0x86,0x01,0x83,0x01,0x81,0x01) #oled.sendData(0x83,0x01,0x86,0x01,0xFC,0x7F,0xF8,0x7F,0x00,0x00,0x00,0x00) #oled.sendData(0x00,0x00,0xF8,0x7F,0xFC,0x7F,0x86,0x01,0x83,0x01,0x81,0x01) #oled.sendData(0x83,0x01,0x86,0x01,0xFC,0x7F,0xF8,0x7F,0x00,0x00,0x00,0x00) #oled.sendData(0x00,0x00,0xF8,0x7F,0xFC,0x7F,0x86,0x01,0x83,0x01,0x81,0x01) #oled.sendData(0x83,0x01,0x86,0x01,0xFC,0x7F,0xF8,0x7F,0x00,0x00,0x00,0x00)
Location(46.379805, 16.40028, 0, 10), Location(46.379886, 16.400521, 0, 10), Location(46.379946, 16.400224, 0, 10), Location(46.38004, 16.400047, 0, 10), Location(46.380075, 16.400004, 0, 10), ] def on_button_callback(state): print("button %s" % (("released", "pressed")[state])) if state: global selected_coordinate selected_coordinate += 1 if selected_coordinate == len(test_coordinate): selected_coordinate = 0 gps.set_location(test_coordinate[selected_coordinate]) if __name__ == "__main__": peripherals.register_button_callback_function(on_button_callback) pwm.init() oled.init() leds.init() gps.init() while True: peripherals.loop() gps.loop() pwm.loop() leds.loop() stations.loop()