Modifications

Sauter à la navigation Sauter à la recherche
173 octets ajoutés ,  1 juin 2016 à 15:05
Ligne 31 : Ligne 31 :     
== Vous connecter sur votre routeur WiFi ==
 
== Vous connecter sur votre routeur WiFi ==
The WLAN network card always boots in WLAN.AP mode, so we must first configure it as a station:
+
La carte WiFi/WLAN démarre toujours en mode WLAN.AP (''point d'accès WiFi''), il faut donc commencer par configurer le WiPy comme client (comme une ''station'' en anglais, donc en mode STA):
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 38 : Ligne 38 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Now you can proceed to scan for networks:
+
Il est maintenant possible de réaliser une énumération (un ''scan'') des réseaux WiF:
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
 
nets = wlan.scan()
 
nets = wlan.scan()
 
for net in nets:
 
for net in nets:
     if net.ssid == 'mywifi':
+
     if net.ssid == 'monwifi':
         print('Network found!')
+
         print('Reseau trouvé!')
         wlan.connect(net.ssid, auth=(net.sec, 'mywifikey'), timeout=5000)
+
         wlan.connect(net.ssid, auth=(net.sec, 'ma_cle_wifi'), timeout=5000)
 
         while not wlan.isconnected():
 
         while not wlan.isconnected():
             machine.idle() # save power while waiting
+
             machine.idle() # économiser de l'energie durant les temps d'attente
         print('WLAN connection succeeded!')
+
         print('Connexion WLAN/WiFi OK!')
 
         break
 
         break
 
</syntaxhighlight>
 
</syntaxhighlight>
29 917

modifications

Menu de navigation