Open esportsim opened 3 years ago
@esportsim Leonardo differs from Arduino UNO in that it uses a single ATmega32U4 microcontroller to execute sketches and also performs USB communication.
In Leonardo, the Serial
class refers to a virtual serial driver between a PC and Leonardo via USB. Unlike traditional Arduino boards such as the Arduino Uno, this is not connected to pins 0 and 1. https://www.arduino.cc/reference/en/language/functions/communication/serial/
To use the hardware serial ports with Leonardo (pins 0 and 1, RX and TX), you must use the Serial1
class. Change the _ESP8266_SERIAL
definition as Serial
to Serial1
.
https://github.com/Hieromon/ESP8266/blob/89425c89087ac58d967fe832a3043d155c3edc2d/ESP8266.h#L55-L58
Or switch to software serial. https://github.com/Hieromon/ESP8266/wiki#softwareserial
Hi, if I select Leonardo board on Arduino IDE(v1.8.15) I have problem during compiling. If I select Arduino UNO I don't have any error. The error is this:
/Users/carlo/Documents/Arduino/libraries/ESP8266-master/ESP8266.cpp:42:29: error: no matching function for call to 'ESP8266::ESP8266(Serial_&)' ESP8266 WiFi(_ESP8266_SERIAL); ^ In file included from /Users/carlo/Documents/Arduino/libraries/ESP8266-master/ESP8266.cpp:12:0: /Users/carlo/Documents/Arduino/libraries/ESP8266-master/ESP8266.h:166:2: note: candidate: ESP8266::ESP8266(_ESP8266_SERIAL_TYPE&) ESP8266(_ESP8266_SERIAL_TYPE &uart); ^~~~~~~ /Users/carlo/Documents/Arduino/libraries/ESP8266-master/ESP8266.h:166:2: note: no known conversion for argument 1 from 'Serial_' to '_ESP8266_SERIAL_TYPE& {aka HardwareSerial&}' /Users/carlo/Documents/Arduino/libraries/ESP8266-master/ESP8266.h:144:7: note: candidate: constexpr ESP8266::ESP8266(const ESP8266&) class ESP8266 { ^~~~~~~ /Users/carlo/Documents/Arduino/libraries/ESP8266-master/ESP8266.h:144:7: note: no known conversion for argument 1 from 'Serial_' to 'const ESP8266&' /Users/carlo/Documents/Arduino/libraries/ESP8266-master/ESP8266.h:144:7: note: candidate: constexpr ESP8266::ESP8266(ESP8266&&) /Users/carlo/Documents/Arduino/libraries/ESP8266-master/ESP8266.h:144:7: note: no known conversion for argument 1 from 'Serial_' to 'ESP8266&&' exit status 1
how can I solve this problem? thank you very much