Hallo liebe Arduino Gemeinde,
ich interessiere mich für die ESP8266 Chips und habe sowohl die Version 01 mit 2 GPIO's, als auch die Version E12 oder 12E mit Mini-USB Buchse bei mir liegen. Da ich zu einem neuen Computer gewechselt bin, habe ich Arduino komplett neu aufgespielt (V. 1.6.8) + die bei den Voreinstellungen für die Board-URLS "http://arduino.esp8266.com/stable/package_esp8266com_index.json" eingegeben und die nötigen Konfigurationen für die ESP8266 Module heruntergeladen + installiert.
Mit Male>Female Kabeln habe ich das ESP mit meinem seriellen Wandler auf einem Breadboard aufgesteckt. Strom fließt aus 2 x 1,5 V Batterien an den ESP - Ground vom seriellen Wandler wird scheinbar auch zur Kommunikation benötigt. Aufbau im Prinzip wie hier.
Die AT-Kommandos funktionieren prima, allerdings scheitere ich beim hochladen vom Seriellen Konverter an das ESP8266 (V.01) Modul. Muss ich da noch irgendwas beachten? Muss noch eine andere Firmware drauf? Beim Upload habe ich als Board > "Generic ESP8266 Modul" ausgewählt, Programmer>"AVRISP mkII" (habe in vielen Youtube und Tutorials hier "esptool" gesehen, da habe ich aber nicht bei mir - bzw. schreiben viele das es eh ignoriert wird?!?) und Baudrate>"115200" ausgewählt.
AT+GRM gibt mir folgendes aus:
AT version:0.40.0.0(Aug 8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04
Das ist der Fehler in der Konsole:
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
Hier der Sketch:
/*
- This sketch demonstrates how to set up a simple HTTP-like server.
- The server will set a GPIO pin depending on the request
- http://server_ip/gpio/0 will set the GPIO2 low,
- http://server_ip/gpio/1 will set the GPIO2 high
- server_ip is the IP address of the ESP8266 module, will be
- printed to Serial when the module is connected.
*/#include <ESP8266WiFi.h>
const char* ssid = "XXXXXXXXXXXXXX";
const char* password = "XXXXXXXXXXXX";// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);void setup() {
Serial.begin(115200);
delay(10);// prepare GPIO2
pinMode(2, OUTPUT);
digitalWrite(2, 0);// Connect to 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");// Start the server
server.begin();
Serial.println("Server started");// Print the IP address
Serial.println(WiFi.localIP());
}void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}// Wait until the client sends some data
Serial.println("new client");
while(!client.available()){
delay(1);
}// Read the first line of the request
String req = client.readStringUntil('\r');
Serial.println(req);
client.flush();// Match the request
int val;
if (req.indexOf("/gpio/0") != -1)
val = 0;
else if (req.indexOf("/gpio/1") != -1)
val = 1;
else {
Serial.println("invalid request");
client.stop();
return;
}// Set GPIO2 according to the request
digitalWrite(2, val);client.flush();
// Prepare the response
String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n\r\n\r\nGPIO is now ";
s += (val)?"high":"low";
s += "\r\n<a href="/gpio/0">ON\r\n<a href="/gpio/1">OFF\n";// Send the response to the client
client.print(s);
delay(1);
Serial.println("Client disonnected");// The client will actually be disconnected
// when the function returns and 'client' object is detroyed
}
Vielen Dank für eure Hilfe.