Skip to content

Instantly share code, notes, and snippets.

@unforgiven512
Created July 18, 2019 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unforgiven512/635846c02af7fb26e98c23857690f0d3 to your computer and use it in GitHub Desktop.
Save unforgiven512/635846c02af7fb26e98c23857690f0d3 to your computer and use it in GitHub Desktop.
old boot.py file on MicroPython ESP8266 board #7
# 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