Ligne 1 : |
Ligne 1 : |
| {{FEATHER-ESP8266-NAV}} | | {{FEATHER-ESP8266-NAV}} |
− |
| |
− | {{traduction}}
| |
| | | |
| == Préambule == | | == Préambule == |
Ligne 66 : |
Ligne 64 : |
| | | |
| == Exemple Blink == | | == Exemple Blink == |
− | {{traduction}}
| |
− |
| |
| Nous allons commencer par un exemple simple: "Blink" (faire clignoter une LED) | | Nous allons commencer par un exemple simple: "Blink" (faire clignoter une LED) |
| | | |
Ligne 90 : |
Ligne 86 : |
| | | |
| == Se connecter en WiFi == | | == Se connecter en WiFi == |
− | OK once you've got the LED blinking, lets go straight to the fun part, connecting to a webserver. Create a new sketch with this code:
| + | Maintenant que nous avons réussit à faire clignoter une LED, nous devrions nous pencher sur ces choses vraiment amusantes, nous connecter sur un Serveur Web. |
| + | |
| + | Créez un nouveau croquis avec le code suivant: |
| | | |
− | <nowiki> /* | + | <nowiki>/* |
− | * Simple HTTP get webclient test | + | * Test WebClient - simple requete HTTP (get) |
| */ | | */ |
| | | |
| #include <ESP8266WiFi.h> | | #include <ESP8266WiFi.h> |
| | | |
− | const char* ssid = "yourssid"; | + | const char* ssid = "votre_ssid"; |
− | const char* password = "yourpassword"; | + | const char* password = "votre_mot_de_passe"; |
| | | |
| const char* host = "www.adafruit.com"; | | const char* host = "www.adafruit.com"; |
Ligne 107 : |
Ligne 105 : |
| delay(100); | | delay(100); |
| | | |
− | // We start by connecting to a WiFi network | + | // Commencons par nous connecter sur le reseau WiFi |
| | | |
| Serial.println(); | | Serial.println(); |
| Serial.println(); | | Serial.println(); |
− | Serial.print("Connecting to "); | + | Serial.print("Connexion sur "); |
| Serial.println(ssid); | | Serial.println(ssid); |
| | | |
Ligne 122 : |
Ligne 120 : |
| | | |
| Serial.println(""); | | Serial.println(""); |
− | Serial.println("WiFi connected"); | + | Serial.println("WiFi connecté"); |
− | Serial.println("IP address: "); | + | Serial.println("adresse IP: "); |
| Serial.println(WiFi.localIP()); | | Serial.println(WiFi.localIP()); |
| } | | } |
Ligne 133 : |
Ligne 131 : |
| ++value; | | ++value; |
| | | |
− | Serial.print("connecting to "); | + | Serial.print("connexion sur "); |
| Serial.println(host); | | Serial.println(host); |
| | | |
− | // Use WiFiClient class to create TCP connections | + | // Utiliser la classe WiFiClient pour |
| + | // creer une connexion TCP |
| WiFiClient client; | | WiFiClient client; |
| const int httpPort = 80; | | const int httpPort = 80; |
| if (!client.connect(host, httpPort)) { | | if (!client.connect(host, httpPort)) { |
− | Serial.println("connection failed"); | + | Serial.println("Echec connexion"); |
| return; | | return; |
| } | | } |
| | | |
− | // We now create a URI for the request | + | // Créer une URI pour la requete |
| String url = "/testwifi/index.html"; | | String url = "/testwifi/index.html"; |
− | Serial.print("Requesting URL: "); | + | Serial.print("Requete de l URL: "); |
| Serial.println(url); | | Serial.println(url); |
| | | |
− | // This will send the request to the server | + | // Cela envoi la requête vers le serveur |
| client.print(String("GET ") + url + " HTTP/1.1\r\n" + | | client.print(String("GET ") + url + " HTTP/1.1\r\n" + |
| "Host: " + host + "\r\n" + | | "Host: " + host + "\r\n" + |
Ligne 155 : |
Ligne 154 : |
| delay(500); | | delay(500); |
| | | |
− | // Read all the lines of the reply from server and print them to Serial | + | // Lire toutes les lignes de la réponse |
| + | // renvoyée par le serveur. |
| + | // Afficher toutes les signes sur la connexion serie |
| while(client.available()){ | | while(client.available()){ |
| String line = client.readStringUntil('\r'); | | String line = client.readStringUntil('\r'); |
Ligne 162 : |
Ligne 163 : |
| | | |
| Serial.println(); | | Serial.println(); |
− | Serial.println("closing connection"); | + | Serial.println("Fermeture de la connexion"); |
| }</nowiki> | | }</nowiki> |
| | | |
− | Dont forget to update
| + | N'oubliez pas de mentionner l'identifiant de votre connexion WiFi |
| + | |
| + | <nowiki>const char* ssid = "votre_ssid"; |
| + | const char* password = "votre_mot_de_passe";</nowiki> |
| | | |
− | <nowiki>const char* ssid = "yourssid";
| + | ''votre_ssid'' est l'identifiant de votre point d'accès (modem WiFi) et ''votre_mot_de_passe'' le mot de passe de votre connexion WiFi. |
− | const char* password = "yourpassword";</nowiki>
| |
| | | |
− | to your access point and password, then upload the same way: get into bootload mode, then upload code via IDE
| + | Faites votre téléchargement comme pour l'exemple "Blink". |
| | | |
| {{ADFImage|FEATHER-ESP8266-Config-Arduino-IDE-30.png|640px}} | | {{ADFImage|FEATHER-ESP8266-Config-Arduino-IDE-30.png|640px}} |
| | | |
− | Open up the IDE serial console at 115200 baud to see the connection and webpage printout!
| + | Ouvrez le terminal série de votre environnement Arduino IDE (connexion à 115200 baud) pour voir la connexion s'établir... et l'affichage du contenu de la page Web! |
| | | |
| {{ADFImage|FEATHER-ESP8266-Config-Arduino-IDE-31.png|640px}} | | {{ADFImage|FEATHER-ESP8266-Config-Arduino-IDE-31.png|640px}} |
| | | |
− | That's it, pretty easy!
| + | C'est simple comme tout! |
| | | |
− | This page was just to get you started and test out your module. For more information, check out le [https://github.com/esp8266/Arduino dépôt GitHub de l'ESP8266] for much more up-to-date documentation!
| + | L'appel de cette page était juste un point de départ pour tester votre module. Voyez le [https://github.com/esp8266/Arduino dépôt GitHub de l'ESP8266] pour plus de documentation! |
| | | |
| | | |
| {{FEATHER-ESP8266-TRAILER}} | | {{FEATHER-ESP8266-TRAILER}} |