No response from device error when uploading a new sketch us
Posted: Mon Jan 15, 2018 5:55 pm
I'm trying to upload sketches without connecting the board to the computer with a USB cable. I started by using the basicOTA program from the examples. I can successfully upload the program and get the IP port with my home wifi information. However, when I want to use that IP port to upload a new sketch, I get an error that says error: No response from device. I added the screen shot of this one and the code I used. I only added the code to turn on an LED to see that the program actually works and does something.
I searched google and the Arduino Forum before I posted this, but I couldn't find anything helpful. It seems other people had this problem before but the solutions given to them didn't help me. Can somebody help me with this problem please?
I searched google and the Arduino Forum before I posted this, but I couldn't find anything helpful. It seems other people had this problem before but the solutions given to them didn't help me. Can somebody help me with this problem please?
Code: Select all
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#define beat 450
const char* ssid = "ID";
const char* password = "pass";
int pin = 14;
void setup() {
pinMode(pin, OUTPUT);
Serial.begin(115200);
Serial.println("Booting");
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Connection Failed! Rebooting...");
delay(5000);
ESP.restart();
}
// Port defaults to 8266
// ArduinoOTA.setPort(8266);
// Hostname defaults to esp8266-[ChipID]
// ArduinoOTA.setHostname("myesp8266");
// No authentication by default
// ArduinoOTA.setPassword((const char *)"123");
ArduinoOTA.onStart([]() {
Serial.println("Start");
});
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.begin();
Serial.println("Ready");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
ArduinoOTA.handle();
heartbeat();
delay(30);
}
void heartbeat() {
digitalWrite(pin, HIGH);
delay(beat);
digitalWrite(pin, LOW);
delay(beat);
}