| API For Arduino developers

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

- File List

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::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:174
ESP8266.h
The definition of class ESP8266.
ESP8266::joinAP
bool joinAP(String ssid, String pwd)
Join in AP.
Definition: ESP8266.cpp:145
ESP8266
Provide an easy-to-use way to manipulate ESP8266.
Definition: ESP8266.h:38
ESP8266::setOprToStation
bool setOprToStation(void)
Set operation mode to staion.
Definition: ESP8266.cpp:87