keokod
April 18, 2022, 7:00am
#1
I, I buy wio with wifi and esp32 inside board mini dev:
I would test this tutorial:
this is the screen shoot test but is fail error oserror -1:
Can we change Ip wio ? 192.168.3.127 to => 192.168.1.45 ??
this is the code:
import network
import usocket
from machine import Pin, I2C, ADC, UART, SPI, PWM
from time import sleep
N1 = network.WLAN_SPI(network.STA_IF)
N1.active(True)
print("API list:")
dir(N1)
print("wifi list:")
lis = N1.scan()
for q in lis:
print(q)
N1.connect("SFR_3A30_GUEST","P34yN5lUuqFy8")
if N1.isconnected():
print(" ip gateway netmask MAC ssid")
print(N1.ifconfig())
s=usocket.socket()
addr=('192.168.1.44',9999)
s.connect(addr)
s.send('Hello! Wio RP2040')
thanks for help
Citric
April 19, 2022, 5:54am
#2
keokod:
oserror -1
Hi, from the picture you provided, the IP address set is not the same as the address of the software and is not turned on.
keokod
April 19, 2022, 2:02pm
#3
Thank’s for reply, Can we with code change ip fixe to ip dhcp in wio ?
I re test application serveur and now the “open” is RED (I know now muste change IP local windows 10 ).
Citric
April 20, 2022, 1:51am
#4
We test to see are using the IP above the software, other IP addresses we have not tried.
keokod
April 20, 2022, 11:02am
#5
thank’s a lot response, this is my vid\u00e9o to test success with ip 192.168.3.1, but I didn’t know how change IP wio to 192.168.1.44 (fore exemple) How i can do it ?
I must add middle switch to have local 192.168.3.1 for wio connecte to switch and connect to local (look at the end video …), I want to learn how change IP WIO to 192.168.1.44 instead of 192.168.3.123 witch script python,
I try this but not success
```
#LAN Communications - Seeed Wiki
import network
import usocket
from machine import Pin, I2C, ADC, UART, SPI, PWM
from time import sleep
N1 = network.WLAN_SPI(network.STA_IF)
N1.active(True)
print(“API list:”)
dir(N1)
print(“wifi list:”)
lis = N1.scan()
for q in lis:
*** print(q)***
***# ps://docs.micropython.org/en/v1.9.3/wipy/library/network.html
N1.connect(“password”,“ssid”)
if N1.isconnected():
print(" ip gateway netmask MAC ssid")
N1.ifconfig(config=(‘dhcp’)) <==== WANT DHCP to connecte my router 192.168.1.1
print(N1.ifconfig())
s=usocket.socket()
addr=(‘192.168.1.23’,9999)
s.connect(addr)
s.send(‘Hello! Wio RP2040’)
[look end video to success test only IP not dhcp](https://www.youtube.com/watch?v=nRk2UMP-Ufs)
keokod
April 26, 2022, 1:31pm
#6
Ok I sucess without GUI, I clean my box internet SFR and I throw this commande
pi@ohkod:~/automate/ohkod_relais/server/test $ nc -l -vv -p 9999
Listening on 0.0.0.0 9999
Connection received on espressif 62682
wio avec ohkod
that’s OK, the wio is connected DHCP without touch orignal example:
import network
import usocket
from machine import Pin, I2C, ADC, UART, SPI, PWM
from time import sleep
N1 = network.WLAN_SPI(network.STA_IF)
N1.active(True)
print(N1.ifconfig())
print("API list:")
dir(N1)
print("wifi list:")
lis = N1.scan()
for q in lis:
print(q)
N1.connect("name_ssid","mdpmdp...")
if N1.isconnected():
print(" ip gateway netmask MAC ssid")
print(N1.ifconfig())
s=usocket.socket()
addr=('192.168.1.46',9999)
s.connect(addr)
s.send("wio avec ohkod")