警告:espcomm_sync 失败错误:espcomm_open 失败错误:espcomm_upload_mem 失败 [英] warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed

查看:25
本文介绍了警告:espcomm_sync 失败错误:espcomm_open 失败错误:espcomm_upload_mem 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 /*
 * 115200. Connect GPIO 0 of your ESP8266 to VCC and reset the board
 */

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

MDNSResponder mdns;

// Network id and pw
const char* ssid = "MY_ID";
const char* password = "MY_PASSWORD";

ESP8266WebServer server(80);

String webPage = "";

int gpio0_pin = 0;
int gpio2_pin = 2;

void setup(void)
{
  webPage += "<h1>ESP8266 Web Server</h1><p>Socket #1 <a href=\"socket1On\"><button>ON</button></a>&nbsp;<a href=\"socket1Off\"><button>OFF</button></a>    </p>";
  webPage += "<p>Socket #2 <a href=\"socket2On\"><button>ON</button></a>&nbsp;<a     href=\"socket2Off\"><button>OFF</button></a></p>";

  // preparing GPIOs
  pinMode(gpio0_pin, OUTPUT);
  digitalWrite(gpio0_pin, LOW);
  pinMode(gpio2_pin, OUTPUT);
  digitalWrite(gpio2_pin, LOW);

  delay(1000);
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  if (mdns.begin("esp8266", WiFi.localIP()))
    Serial.println("MDNS responder started");

  server.on("/", []()
  {
    server.send(200, "text/html", webPage);
  });

  server.on("/socket1On", []()
  {
    server.send(200, "text/html", webPage);
    digitalWrite(gpio0_pin, HIGH);
    delay(1000);
   });

  server.on("/socket1Off", []()
  {
    server.send(200, "text/html", webPage);
    digitalWrite(gpio0_pin, LOW);
    delay(1000);
  });

  server.on("/socket2On", []()
  {
    server.send(200, "text/html", webPage);
    digitalWrite(gpio2_pin, HIGH);
    delay(1000);
  });

  server.on("/socket2Off", []()
  {
    server.send(200, "text/html", webPage);
    digitalWrite(gpio2_pin, LOW);
    delay(1000);
  });
  server.begin();
  Serial.println("HTTP server started");
}

void loop(void)
{
  server.handleClient();
}

我正在尝试使用 Arduino 使用 ESP8266 制作 wifi 网络服务器.代码在此链接中:代码.我正在关注本网站的步骤.我已经连接了我的 yp-01(USB 转串口)用我的 ESP8266.

Hi I'm trying to make a wifi webserver with the ESP8266 using an Arduino. The code is in this link: code. I'm following the steps of this site. I've connected my yp-01 (USB to serial) with my ESP8266.

  • USB --> ESP
  • 发送 --> 接收
  • 接收 --> 发送

我使用 arduino mega 的 3.3V 电源.

I use the 3.3V supply of my arduino mega.

  • ARDUINO --> ESP
  • 3.3V --> VCC
  • 地线 --> 地线.

当我尝试上传代码时出现错误:

When I try to upload the code it gives the error:

警告:espcomm_sync 失败错误:espcomm_open失败错误:espcomm_upload_mem 失败

warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed

我读了很多帖子,但没有一个能解决我的问题.有没有人知道解决方案或遇到同样问题的人?我使用的是 ARduino IDE 1.6.9

I've read a lot of posts but none of them fixed my problem. Is there anyone who knows the solution or someone who had the same problem? I'm using ARduino IDE 1.6.9

推荐答案

使用 10k 电阻将 GPIO0 和 GPIO15 接地.

Connect GPIO0 and GPIO15 to Ground with resistors 10k.

这篇关于警告:espcomm_sync 失败错误:espcomm_open 失败错误:espcomm_upload_mem 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆