I recently bought the Wipy development board to try Python (a friend of mine is a big fan), and will have a TI CC3200 (ARM Cortex-M4+wifi) development board even if I prefer develop in C.
Here is just a snippet allowing to ground or set to 3.3V GP4 in order to connect to home WLAN or set the card as an access point. Great for on the go development !
# boot.py -- run on boot-up # can run arbitrary Python, but best to keep it minimal # Import libraries from machine import Pin from network import WLAN # Set variables staSsid = ’ssidToConnect' staPassword = ‘password' apSsid = ’ssidInAccessPoint' apPassword = ‘passwordMoreThan8char' # Declare Pin p_select = Pin( 'GP5', mode=Pin.IN ) # Select Wifi mode regarding Pin state if p_select.value() == 1: wlan = WLAN( mode=WLAN.AP ) wlan.init( mode=WLAN.AP, ssid=apSsid, auth=(WLAN.WPA2,apPassword), channel=7, antenna=WLAN.INT_ANT ) else: wlan = WLAN( mode=WLAN.STA ) nets = wlan.scan() for net in nets: if net.ssid == staSsid: wlan.connect( net.ssid, auth=(net.sec, staPassword), timeout=5000 ) while not wlan.isconnected(): machine.idle() # save power while waiting print( 'WLAN connection succeeded!' ) break