def main(): led = ht1632.HT1632C(config.DATAPIN, config.CLKPIN, config.CSPIN) led.fill(0) led.text("Boot", 0, 0) led.show() wifi.ConnectWifi(config.SSID, config.PASSWORD) M8MALJ = config.LINES[0] SchM8MALJ = ratp_api.Schedules(M8MALJ[0], M8MALJ[1], M8MALJ[2], M8MALJ[3]) tries = 0 sc = "" while True: Sched = [] tries = 0 while Sched == [] and tries < 5: tries += 1 Sched = SchM8MALJ.getSchedules() if Sched == []: sc = "Not available" else: sc = str(Sched).replace('[', '').replace(']', '').replace('\'', '') led.fill(0) led.text(' ' + sc, 0, 0) leng = 5 * len(sc) + 5 time.sleep(0.1) while leng > 0: time.sleep(0.025) led.scroll(-1, 0) led.show() leng -= 1
#hardware platform: FireBeetle-ESP8266 import ht1632 import time DATAPIN = 5 CLKPIN = 4 CSPIN = 13 led = ht1632.HT1632C( DATAPIN, CLKPIN, CSPIN) #create LED object,and bind data pin,clk pin,cs pin led.text("DFRobot", 0, 0) #set "DFR" at (0,0) led.show() #display String while True: led.scroll(-1, 0) #Shift the contents of the String by the given vector. led.show() time.sleep(0.01)
#hardware platform: FireBeetle-ESP32 import ht1632 import time DATAPIN = 10 CLKPIN = 13 CSPIN = 25 led = ht1632.HT1632C(DATAPIN, CLKPIN, CSPIN) while True: led.fill(0) led.text("DFR", 0, 0, 1) led.hline(26, 3, 15, 1) led.line(33, 0, 41, 3, 1) led.line(33, 6, 41, 3, 1) led.rect(43, 0, 24, 8, 1) led.show() for i in range(43): led.scroll(-1, 0) led.show() time.sleep(0.1) led.fill_rect(2, 2, 9, 4, 1) led.show() for j in range(2, 6): for i in range(13, 22): led.pixel(i, j, 1) led.show()
#hardware platform: FireBeetle-ESP8266 import ht1632 DATAPIN = 5 CLKPIN = 4 CSPIN = 13 led = ht1632.HT1632C(DATAPIN, CLKPIN, CSPIN, 24, 8) #create LED object,and bind data pin,clk pin,cs pin led.text("DFR", 0, 0) #set "DFR" at (0,0) led.show() #display String while True: led.scroll(-1, 0) #Shift the contents of the String by the given vector. led.show() time.sleep(0.5)