"""
demonstrating the use of log files
this does not work in wokwi, rather copy the code and use Thonny
"""
import time
time.sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
with open("my_file.txt", mode="wt") as f:
f.write("This is text!")
f.write("And some more text")
f.flush()
# for longer
time.sleep(1)
# Open the file in write-text mode
f = open("my_file.txt", mode="wt")
# Write text to the file
f.write("This is text!")
f.write("And some more text")
# Manually close the file to save changes
f.close()