ESP8266
ESP8266 wifi(&EspSerial)
描述 ESP8266用于创建一个ESP8266对象的实例,对象需要用到串口,该对象的名称在代码中用到。
参数
实例
#include <ESP8266.h>
#ifdef ESP32
#error "This code is not recommended to run on the ESP32 platform! Please check your Tools->Board setting."
#endif
/**
**Core+ UART Port: [Serial1] [D2,D3]
**/
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1284P__) || defined (__AVR_ATmega644P__) || defined(__AVR_ATmega128RFA1__)
#define EspSerial Serial1
#define UARTSPEED 115200
#endif
/**
**Core UART Port: [SoftSerial] [D2,D3]
**/
#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega328__) || defined (__AVR_ATmega328P__)
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); /* RX:D2, TX:D3 */
#define EspSerial mySerial
#define UARTSPEED 9600
#endif
ESP8266 wifi(&EspSerial);
void setup(void)
{
}
void loop(void)
{
}
|