Badger2040: Use book.txt for ebook example

pull/271/head
Phil Howard 2022-03-04 15:42:47 +00:00
rodzic cbf330a1c7
commit ddf5f7631e
1 zmienionych plików z 9 dodań i 6 usunięć

Wyświetl plik

@ -3,12 +3,19 @@ import machine
import time
import gc
# **** Put the name of your text file here *****
text_file = "book.txt" # File must be on the MicroPython device
try:
open("witw.txt", "r")
open(text_file, "r")
except OSError:
try:
# If the specified file doesn't exist,
# pre-populate with Wind In The Willows
import witw
open("witw.txt", "wb").write(witw.data())
open(text_file, "wb").write(witw.data())
del witw
except ImportError:
pass
@ -16,10 +23,6 @@ except OSError:
gc.collect()
# **** Put the name of your text file here *****
text_file = "witw.txt" # File must be on the MicroPython device
# Global Constants
WIDTH = badger2040.WIDTH
HEIGHT = badger2040.HEIGHT