Created
July 18, 2019 21:55
-
-
Save unforgiven512/635846c02af7fb26e98c23857690f0d3 to your computer and use it in GitHub Desktop.
old boot.py file on MicroPython ESP8266 board #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is executed on every boot (including wake-boot from deepsleep) | |
import esp | |
import gc | |
import webrepl | |
import machine | |
import network | |
# import socket | |
# Disable debug output | |
esp.osdebug(None) | |
# Set frequency to 160 MHz | |
machine.freq(160000000) | |
# Create objects for network interfaces | |
sta_if = network.WLAN(network.STA_IF) | |
ap_if = network.WLAN(network.AP_IF) | |
# Ensure the STA interface is active, and the AP interface is NOT active. | |
sta_if.active(True) | |
ap_if.active(False) | |
# Start WebREPL | |
webrepl.start() | |
# Determine reset cause | |
if machine.reset_cause() == machine.DEEPSLEEP_RESET: | |
print('\n\t*** RESET: woke from deep sleep ***\n') | |
else: | |
print('\n\t*** RESET: woke from hard reset ***\n') | |
# Perform Garbage Collection | |
gc.collect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment