Playing with WiFly

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
mosi
Posts: 28
Joined: Tue Oct 07, 2014 12:07 am

Playing with WiFly

Post by mosi » Fri Nov 07, 2014 12:28 am

testing WiFly RN-171 wifi module with stack plugged on UART3.

Letting the wifi run is as easy as:

Code: Select all

def ww(arg):
  wifi.write(arg+'\r')
  print(wifi.read().decode("utf-8"))


wifi=pyb.UART(3,9600)
wifi.write('$$$') # start command mode 
wifi.any()
wifi.read()
ww('set wlan ssid MySSID')
ww('set wlan passphrase MyWifiPassword')
# 4=WPA2 PSK
ww('set wlan auth 4')
# DHCP client 0=static IP 1=dhcp client 2=autoIP 3=DHCP cached 4=DHCP server AP  
ww('set ip dhcp 1') 
ww('join MySSID_network')
ww('get ip')
ww('get ip')
What would be the easiest / fastest strategy to accept commands over wifi to be executed in micropython?

You can actually open a remote wifi socket to the wifi with telnet on default port 2000:
telnet 10.1.1.13 2000
Trying 10.1.1.13...
Connected to 10.1.1.13.
Escape character is '^]'.
*HELLO*
$$$
CMD
get ip
get ip

IF=UP
DHCP=ON
IP=10.1.1.13:2000
NM=255.255.255.0
GW=10.1.1.1
HOST=0.0.0.0:2000
PROTO=TCP,
MTU=1524
FLAGS=0x7
TCPMODE=0x0
BACKUP=0.0.0.0
<4.00>
I would rather not poll for wifi.any() in a while True loop.
Thank you for any hints.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Playing with WiFly

Post by dhylands » Fri Nov 07, 2014 12:32 am

This post doesn't seem to have anything to do with the "Playing with Interrupts" thread that it was attached to, so I split it off into a separate thread.

Post Reply