Différences entre versions de « FEATHER-ESP8266-Config-Arduino-IDE »
Ligne 30 : | Ligne 30 : | ||
− | [[FEATHER-M0-Config-Arduino-IDE Visitez ce guide sur le Feather M0 pour avoir plus de détails sur l'ajout du support de nouvelles cartes sous '''Arduino IDE 1.6.4+''']]. | + | [[FEATHER-M0-Config-Arduino-IDE|Visitez ce guide sur le Feather M0 pour avoir plus de détails sur l'ajout du support de nouvelles cartes sous '''Arduino IDE 1.6.4+''']]. |
Next, use the '''Board manager''' to install the ESP8266 package. | Next, use the '''Board manager''' to install the ESP8266 package. |
Version du 5 mai 2016 à 15:54
En cours de traduction/élaboration. |
Préambule
While the Feather HUZZAH ESP8266 comes pre-programmed with NodeMCU's Lua interpretter, you don't have to use it! Instead, you can use the Arduino IDE which may be more familar. This will write directly to the firmware, erasing the NodeMCU firmware, so if you want to go back to Lua, use the flasher to re-install it
In order to upload code to the ESP8266 and use the serial console, connect any data-capable micro USB cable to the Feather HUZZAH and the other side to your computer's USB port. Install the required CP2104 USB driver to have the COM/Serial port appear properly
N'oubliez pas d'installer le Pilote USB pour le convertisseur USB-vers-Serie CP2104! |
Installer Arduino IDE 1.6.4
Install the Arduino IDE 1.6.4 or greater
You can also try downloading the ready-to-go package from the ESP8266-Arduino project, if the proxy is giving you problems
We're seeing some difficulties with IDE 1.6.6 so please try 1.6.5 or skip 1.6.6! |
Installer le support ESP8266
Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field in the Arduino v1.6.4+ preferences.
Crédit: AdaFruit Industries www.adafruit.com
Next, use the Board manager to install the ESP8266 package.
Crédit: AdaFruit Industries www.adafruit.com
Configurer le support ESP8266
When you've restarted, select Generic ESP8266 Module from the Tools->Board dropdown
Crédit: AdaFruit Industries www.adafruit.com
80 MHz as the CPU frequency
Crédit: AdaFruit Industries www.adafruit.com
115200 baud upload speed (You can also try faster baud rates, we were able to upload at a blistering 921600 baud but sometimes it fails & you have to retry)
Crédit: AdaFruit Industries www.adafruit.com
The matching COM port for your FTDI or USB-Serial cable
Crédit: AdaFruit Industries www.adafruit.com
and nodemcu as the reset method
Crédit: AdaFruit Industries www.adafruit.com
Check also that you have
- Flash Mode : QIO
- Flash Frequency : 40MHz
- Upload Using : Serial
- CPU Frequency : 80 MHz
- Flash Size : 4M
- Reset Method : nodemcu
Exemple Blink
We'll begin with the simple blink test
Enter this into the sketch window (and save since you'll have to)
void setup() { pinMode(0, OUTPUT); } void loop() { digitalWrite(0, HIGH); delay(500); digitalWrite(0, LOW); delay(500); }
Now you can simply upload! The Feather HUZZAH has built in auto-reset that puts it into bootloading mode automagically
Crédit: AdaFruit Industries www.adafruit.com
The sketch will start immediately - you'll see the LED blinking. Hooray!
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:
/* * Simple HTTP get webclient test */ #include <ESP8266WiFi.h> const char* ssid = "yourssid"; const char* password = "yourpassword"; const char* host = "www.adafruit.com"; void setup() { Serial.begin(115200); delay(100); // We start by connecting to a WiFi network Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); } int value = 0; void loop() { delay(5000); ++value; Serial.print("connecting to "); Serial.println(host); // Use WiFiClient class to create TCP connections WiFiClient client; const int httpPort = 80; if (!client.connect(host, httpPort)) { Serial.println("connection failed"); return; } // We now create a URI for the request String url = "/testwifi/index.html"; Serial.print("Requesting URL: "); Serial.println(url); // This will send the request to the server client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n\r\n"); delay(500); // Read all the lines of the reply from server and print them to Serial while(client.available()){ String line = client.readStringUntil('\r'); Serial.print(line); } Serial.println(); Serial.println("closing connection"); }
Dont forget to update
const char* ssid = "yourssid"; const char* password = "yourpassword";
to your access point and password, then upload the same way: get into bootload mode, then upload code via IDE
Crédit: AdaFruit Industries www.adafruit.com
Open up the IDE serial console at 115200 baud to see the connection and webpage printout!
Crédit: AdaFruit Industries www.adafruit.com
That's it, pretty easy!
This page was just to get you started and test out your module. For more information, check out le dépôt GitHub de l'ESP8266 for much more up-to-date documentation!
Source: Adafruit Feather ESP8266 créé par LadyAda pour AdaFruit Industries. Crédit [www.adafruit.com AdaFruit Industries]
Traduit par Meurisse D. pour MCHobby.be
Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com
Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : « Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.
L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.