README - Update install section (WiFi config) (#4)

This commit is contained in:
iGoX 2024-12-23 15:57:19 +01:00
parent 47f63db85f
commit 086a4de44a
2 changed files with 10 additions and 6 deletions

View file

@ -1,21 +1,20 @@
# This file is executed on every boot (including wake-boot from deepsleep) # This file is executed on every boot (including wake-boot from deepsleep)
# It is executed after boot.py, before main.py # It is executed before main.py
import os, machine import os, machine
import network import network
import gc import gc
gc.collect() gc.collect()
# Disable Access Point
ap_if = network.WLAN(network.AP_IF)
ap_if.active(False)
# Connect to the WIFI when booting # --- WIFI Configuration ---
SSID = '<YOUR WIFI SSID>' # Set the WIFI network SSID SSID = '<YOUR WIFI SSID>' # Set the WIFI network SSID
PASSWORD = '<YOUR WIFI PASSWORD>' # Set the WIFI network password PASSWORD = '<YOUR WIFI PASSWORD>' # Set the WIFI network password
network.country('<YOUR COUNTRY CODE>') # Set the country code for the WIFI (ISO 3166-1 Alpha-2 country code) network.country('<YOUR COUNTRY CODE>') # Set the country code for the WIFI (ISO 3166-1 Alpha-2 country code)
network.hostname('busylight-esp32') # Hostname that will identify this device on the network network.hostname('busylight-esp32') # Hostname that will identify this device on the network
# --------------------------
# Function to connect to the WIFI
def boot_wifi_connect(): def boot_wifi_connect():
wlan = network.WLAN(network.STA_IF) wlan = network.WLAN(network.STA_IF)
if not wlan.isconnected(): if not wlan.isconnected():
@ -25,10 +24,13 @@ def boot_wifi_connect():
while not wlan.isconnected(): while not wlan.isconnected():
pass pass
ip, mask, gateway, dns = wlan.ifconfig() ip, mask, gateway, dns = wlan.ifconfig()
# Print the network configuration
print('\nNetwork config:') print('\nNetwork config:')
print('- IP address: ' + ip) print('- IP address: ' + ip)
print('- Network mask: ' + mask) print('- Network mask: ' + mask)
print('- Network gateway: ' + gateway) print('- Network gateway: ' + gateway)
print('- DNS server: ' + dns + '\n') print('- DNS server: ' + dns + '\n')
# Connect to the WIFI when booting
boot_wifi_connect() boot_wifi_connect()

View file

@ -103,7 +103,9 @@ It will automatically switch to the BusyLight in:
|-------------------------------|-------------------------------------| |-------------------------------|-------------------------------------|
| ![lib-menu](img/lib-menu.png) | ![lib-install](img/lib-install.png) | | ![lib-menu](img/lib-menu.png) | ![lib-install](img/lib-install.png) |
**(3)** Drop the content of [ESP32](ESP32/) folder to the root directory of your ESP32 file system. Again, can easily be done using [Thonny](https://thonny.org): **(3)** Edit the `WIFI Configuration` section in the [boot.py](/ESP32/boot.py) file.
**(4)** Copy the content of [ESP32](ESP32/) folder with the modified `boot.py` file to the root of your ESP32 file system. Again, can easily be done using [Thonny](https://thonny.org):
![file-copy](img/file-copy.png) ![file-copy](img/file-copy.png)