Problem flashing program to Arduino / esp8266 -> getting the following error

风格不统一 提交于 2020-03-25 13:50:11

问题


The error is:

Arduino: 1.8.12 (Windows 10), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Executable segment sizes:


IROM   : 329240          - code in flash         (default or ICACHE_FLASH_ATTR) 


IRAM   : 27992   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 


DATA   : 1408  )         - initialized variables (global, static) in RAM/HEAP 


RODATA : 2044  ) / 81920 - constants             (global, static) in RAM/HEAP 


BSS    : 25168 )         - zeroed variables      (global, static) in RAM/HEAP 


Sketch uses 360684 bytes (34%) of program storage space. Maximum is 1044464 bytes.
Global variables use 28620 bytes (34%) of dynamic memory, leaving 53300 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port COM4
Connecting........_____....._____....._____....._____....._____....._____....._____
Traceback (most recent call last):
  File "C:\Users\nEW u\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.2/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "C:/Users/nEW u/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.6.2/tools/esptool\esptool.py", line 2890, in main
    esp.connect(args.before)
  File "C:/Users/nEW u/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.6.2/tools/esptool\esptool.py", line 483, in connect
    raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Invalid head of packet (0xF0)
esptool.FatalError: Failed to connect to ESP8266: Invalid head of packet (0xF0)

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Here is my pin configuration for my ultrasonic sensor with arduino

1. VCC pin to +5v on the Arduino board.
2. Trigger to digital pin 7 on your Arduino board.
3. Echo to digital pin 6 on your Arduino board.
4. GND with GND on Arduino.

Here is my code which i am executing


#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
// Set these to run example. 
#define FIREBASE_HOST "......"              //cannot share for privacy purpose 
#define FIREBASE_AUTH "......"              //cannot share for privacy purpose
#define WIFI_SSID "SSID" 
#define WIFI_PASSWORD "PASSWORD" 

const int pingPin = 7; 
const int echoPin = 6;
String myString;

void setup() { 
 Serial.begin(9600); 
 // connect to wifi. 
 WiFi.begin(WIFI_SSID, WIFI_PASSWORD); 
 Serial.print("connecting"); 
 while (WiFi.status() != WL_CONNECTED) { 
   Serial.print("."); 
   delay(500); 
 } 
 Serial.println(); 
 Serial.print("connected: "); 
 Serial.println(WiFi.localIP()); 
 Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); 
} 

void loop() { 
  long duration, inches, cm;
   pinMode(pingPin, OUTPUT);
   digitalWrite(pingPin, LOW);
   delayMicroseconds(2);
   digitalWrite(pingPin, HIGH);
   delayMicroseconds(10);
   digitalWrite(pingPin, LOW);
   pinMode(echoPin, INPUT);
   duration = pulseIn(echoPin, HIGH);
   cm = microsecondsToCentimeters(duration);
   Serial.print(cm);
   Serial.print("cm");
   Serial.println();
   delay(100);
   myString= String(duration);
   Firebase.setString("Ultrasonic/DistanceInCm",myString);
   delay(1000);
}

long microsecondsToCentimeters(long microseconds) {
   return microseconds / 29 / 2;
}

The code is about taking information from my ultrasonic distance sensor and then show it in the firebase realtime database using the esp8266 wifi module Please guide me what i am doing wrong and i more information is needed let me know


回答1:


Try to give the exact hardware you use.
The error message shows a problem flashing to a NodeMCU (NodeMCU 0.9 (ESP-12 Module)),your schematics show an Arduino UNO with an ESP module.
Check the following:
Is the correct hardware selected for flashing
Is the right driver installed for the usb port you use
Is the correct usb port selected

To sum it up - your program is not even transfered to the used hardware. Read the error message carefúlly its stating "FatalError('Failed to connect to" -> its not recognizing the attached hardware



来源:https://stackoverflow.com/questions/60735242/problem-flashing-program-to-arduino-esp8266-getting-the-following-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!