| API For Arduino developers

- Main Page
- Related Pages
- Classes
- Files
- Examples

- File List
- File Members

ConnectWiFi.ino
1
21 #include "ESP8266.h"
22
23 #define SSID "ITEAD"
24 #define PASSWORD "12345678"
25
26 ESP8266 wifi(Serial1);
27
28 void setup(void)
29 {
30 Serial.begin(9600);
31 Serial.print("setup begin\r\n");
32
33 Serial.print("FW Version: ");
34 Serial.println(wifi.getVersion().c_str());
35
36
37 if (wifi.setOprToStation()) {
38 Serial.print("to station ok\r\n");
39 } else {
40 Serial.print("to station err\r\n");
41 }
42
43 if (wifi.joinAP(SSID, PASSWORD)) {
44 Serial.print("Join AP success\r\n");
45 Serial.print("IP: ");
46 Serial.println(wifi.getLocalIP().c_str());
47 } else {
48 Serial.print("Join AP failure\r\n");
49 }
50
51 Serial.print("setup end\r\n");
52 }
53
54 void loop(void)
55 {
56 }
57
ESP8266::joinAP
bool joinAP(String ssid, String pwd, uint8_t pattern=3)
Join in AP.
Definition: ESP8266.cpp:178
ESP8266::getVersion
String getVersion(void)
Get the version of AT Command Set.
Definition: ESP8266.cpp:80
ESP8266::getLocalIP
String getLocalIP(void)
Get the IP address of ESP8266.
Definition: ESP8266.cpp:281
ESP8266.h
The definition of class ESP8266.
ESP8266
Provide an easy-to-use way to manipulate ESP8266.
Definition: ESP8266.h:42
ESP8266::setOprToStation
bool setOprToStation(uint8_t pattern1=3, uint8_t pattern2=3)
Set operation mode to station.
Definition: ESP8266.cpp:107