diff --git a/content/firmwareapi/pycom/pycom.md b/content/firmwareapi/pycom/pycom.md index ba929cd..92ed327 100644 --- a/content/firmwareapi/pycom/pycom.md +++ b/content/firmwareapi/pycom/pycom.md @@ -89,11 +89,18 @@ Allows you permanently disable or enable the heartbeat LED. Once this setting is ### pycom.lte_modem_on_boot([boolean]) Get or set the LTE modem on boot flag. When this flag is set to `True`, the LTE modem will be enabled. + ### pycom.wifi_on_boot([boolean]) -Get or set the WiFi on boot flag. When this flag is set to `True`, The WiFi will be enabled according to the other WiFi settings. when `False` the WiFi module will be disabled untill enabled directly via WLAN class. +Get or set the WiFi on boot flag. When this flag is set to `True`, The WiFi will be enabled according to the other WiFi settings. when `False` the WiFi module will be disabled until enabled directly via WLAN class. This setting is stored in the non-volatile memory which preserves it across resets and power cycles. See [FTP & Telnet](/gettingstarted/programming/ftp/) for more information on possible usage. -This setting is stored in non-volatile memory which preserves it across resets and power cycles. +### pycom.wifi_mode_on_boot(mode) + +Set or get the Wifi Mode at startup, valid options are: +* `WLAN.STA` +* `WLAN.AP` +* `WLAN.APSTA` +This setting is stored in non-volatile memory which preserves it across resets and power cycles ### pycom.wifi_ssid_sta([ssid]) @@ -102,7 +109,7 @@ This setting is stored in non-volatile memory which preserves it across resets a ### pycom.wifi_ssid_ap([ssid]) -Get or set the ssid of the Access point that should be started by the device at startup, if not set and startup Wifi mode is AP the default AP name (`Board_Name>-wlan-Note: This method of connection is not recommended for first time users. It is possible to lock yourself out of the device, requiring a USB connection. + The last 4 characters of the broadcast SSID are equal to the last 4 characters of the `unique_id()`: + ```python + import machine + import ubinascii + ubinascii.hexlify(machine.unique_id()) + ``` -Once connected to this network you will be able to access the telnet and FTP servers running on the LoPy4. + Note that if you made changes to the WiFi settings, the AP might not show up by default. You can use the following to get it back up and running: + ```python + import pycom + from network import WLAN + pycom.wifi_on_boot(True) + pycom.wifi_mode_on_boot(WLAN.AP) + ``` -The file system is accessible via the native FTP server running on each Pycom device. Open an FTP client and connect to: + > You can find the methods to change the default settings [here](/firmwareapi/pycom/pycom/#boot-methods) + +2. **Connect through A WiFi Network** + + It is also possible to connect your pycom device to a WiFi network first, and then connect to its IP address. Note that you will have to figure out its IP address before you can access the FTP server. For that, you can use the following command. This will return a tuple with four items, where the first item will contain the assigned IP address. + ```python + wlan.ifconfig() + ``` +> Note that if you make changes to the WLAN Configuration in the uploaded Python code, the connection might drop. Moreover, if your program contains continuous reboot loops, sleep cycles or coredumps, you might not be able to recover the wireless connection without [safe booting](../safeboot/) +## FTP Server +The file system is accessible via the native FTP server running on each Pycom device. Open a FTP client and connect to: * url: `ftp://192.168.4.1` * username: `micro` * password: `python` -See [network.server](/firmwareapi/pycom/network/server/) for information on how to change the defaults. The recommended clients are: +> See [network.server](/firmwareapi/pycom/network/server/) for information on how to change the default credentials. -* macOS/Linux: default FTP client + +## Telnet server +You can use the same credentials to connect to the telnet server to bring up the REPL: +```bash +telnet 192.168.4.1 +``` +Note that the REPL works exactly the same over Telnet as it does through Pymakr. + +## Clients +The recommended clients are: +* macOS/Linux: default FTP / Telnet client * Windows: Filezilla and FireFTP For example, from a macOS/Linux terminal: ```bash -$ ftp 192.168.4.1 +ftp 192.168.4.1 +telnet 192.168.4.1 ``` -The FTP server doesn't support active mode, only passive mode. Therefore, if using the native unix FTP client, immediately after logging in, run the following command: +The FTP server doesn't support active mode, only passive mode. Therefore, if you are using the native unix FTP client, run the following command after logging in: ```bash ftp> passive @@ -43,7 +77,7 @@ ftp> passive The FTP server only supports one connection at a time. If using other FTP clients, please check their documentation for how to limit the maximum allowed connections to one at a time. -## FileZilla +### FileZilla If using FileZilla, it's important to configure the settings correctly. @@ -55,3 +89,7 @@ In the `Transfer Settings` tab, limit the max number of connections to one. Othe ![](/gitbook/assets/filezilla-settings-2.png) + + + +