Connect the Wipy to a wlan

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
marcus
Posts: 7
Joined: Fri Oct 30, 2015 3:53 pm

Connect the Wipy to a wlan

Post by marcus » Sun May 01, 2016 11:54 am

Hi,

i try to connect my wipy to my wireless home network.
From the docs i copied and modified the following code to boot.py:

Code: Select all

from network import WLAN
wlan = WLAN(mode=WLAN.STA)
nets = wlan.scan()
for net in nets:
    if net.ssid == 'MYSSID':
        print('Network found!')
        wlan.connect(net.ssid, auth=(net.sec, 'MYPASSWORD'), timeout=5000)
        while not wlan.isconnected():
            machine.idle() # save power while waiting
        print('WLAN connection succeeded!')
        break
This doesn't work.
The wipy seems to be still in AP mode, i can the ssid in the networks list of my PC.
But i can't connect to the network anymore.

Can somebody please direct me to a working code example or does anybody see whats wrong here?

Thanks a lot!

Marcus

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Connect the Wipy to a wlan

Post by danicampora » Sun May 01, 2016 12:24 pm

Hello,

If you only run:

Code: Select all

from network import WLAN
wlan = WLAN(mode=WLAN.STA)
nets = wlan.scan()
for net in nets:
    print(net)
Do you see the list of networks? What makes you think that it's still in AP mode? Are you connected to the WiPy via serial (USB)?

Cheers,
Daniel

marcus
Posts: 7
Joined: Fri Oct 30, 2015 3:53 pm

Re: Connect the Wipy to a wlan

Post by marcus » Sun May 01, 2016 1:48 pm

Hi Daniel,

thanks for your response.
I connect via telnet and ftp to the wipy.

Code: Select all

For the test i tried to extend your code to write the available ssids to a file.
from network import WLAN
wlan = WLAN(mode=WLAN.STA)
nets = wlan.scan()
dat = open("/flash/wlan.info","w")
for net in nets:
  dat.write(net)
dat.close()
The file was created but it remains empty.
When i try to write i get an OSError: 28.

For AP mode: I saw the wipy in the available wlan list of my laptop which was wrong.
After a reboot the ssid didn't show up again.

Marcus

Post Reply