Page 1 of 1

Connect to REPL over WI-Fi

Posted: Tue Oct 13, 2020 2:44 pm
by MrRobot
I've been trying to use the webrepl functions with the PYBD.

In other threads it hints that this is possible but it doesn't seem to work.

I'm running the latest stable 1.12 release.

I've ran an access point using this code:

Code: Select all

import network

wl_ap = network.WLAN(1)
wl_ap.config(essid='PYBD')          # set AP SSID
wl_ap.config(password='pybd0123')   # set AP password
wl_ap.config(channel=6)             # set AP channel
wl_ap.active(1)                     # enable the AP
I then downloaded the repository from here and connected to webrepl.html

https://github.com/micropython/webrepl

But there's no connection using webrepl.

I can ping 192.168.4.1 no issue.

Is there anyway to get REPL over Wi-Fi on the pyboard D? Or better yet rshell?

Re: Connect to REPL over WI-Fi

Posted: Tue Oct 20, 2020 9:17 am
by MrRobot
For anyone reading this: I figured it out

Make sure you've a decent antenna attached to your Pyboard D

First run this code:

Code: Select all

import webrepl_setup
And follow the prompts (mainly setting a password)

Then run this code:

Code: Select all

import network

wl_ap = network.WLAN(1)
wl_ap.config(essid='SSID')          # set AP SSID
wl_ap.config(password='PASSWORD')   # set AP password
wl_ap.config(channel=6)             # set AP channel
wl_ap.active(1)                     # enable the AP

wl_ap.status('stations')    # get a list of connection stations
Download the webrepl repository from Github: https://github.com/micropython/webrepl

On your device connect to the Wi-Fi network you set up in the code above (SSID)

Open the webrepl.html file from the repository

Click connect and you should be prompted for a password (the one from webrepl_setup)

Hopefully it works for you :D

Re: Connect to REPL over WI-Fi

Posted: Thu Nov 05, 2020 3:48 pm
by kbrenner
Can you explain the steps involved with "On your device connect to the Wi-Fi network you set up in the code above (SSID)"? I am relatively novice with Micropython and the Pyboard in general.

Re: Connect to REPL over WI-Fi

Posted: Thu Nov 05, 2020 4:30 pm
by MrRobot
Whatever you put in for SSID here:

Code: Select all

wl_ap.config(essid='SSID')
The SSID is the Wi-Fi name that you'll see on your PC

Re: Connect to REPL over WI-Fi

Posted: Thu Nov 05, 2020 5:23 pm
by kbrenner
I am able to connect to the Pyboard over wifi, and in my REPL prompt, I see:

DHCPS: client connected: MAC=74:da:38:e8:be:2c IP=192.168.4.16

On my webrepl, I have modified the IP address to look like:

ws://192.168.4.16

However, when I hit connect, it immediately disconnects without anything else showing up. Am I missing a step here?

Re: Connect to REPL over WI-Fi

Posted: Thu Nov 05, 2020 7:35 pm
by Roberthh
Use port 8266:

ws://192.168.4.16:8266