source: rtos_arduino/trunk/arduino_lib/libraries/ESP8266/examples/ConnectWiFi/ConnectWiFi.ino@ 141

Last change on this file since 141 was 141, checked in by ertl-honda, 7 years ago

サンプルが動作するよう修正.

File size: 1.7 KB
Line 
1/**
2 * @example ConnectWiFi.ino
3 * @brief The ConnectWiFi demo of library WeeESP8266.
4 * @author Wu Pengfei<pengfei.wu@itead.cc>
5 * @date 2015.03
6 *
7 * @par Copyright:
8 * Copyright (c) 2015 ITEAD Intelligent Systems Co., Ltd. \n\n
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. \n\n
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 */
21#include "ESP8266.h"
22
23#define SSID "ITEAD"
24#define PASSWORD "12345678"
25
26ESP8266 wifi;
27
28void 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 wifi.begin(Serial5);
38 if (wifi.setOprToStation()) {
39 Serial.print("to station ok\r\n");
40 } else {
41 Serial.print("to station err\r\n");
42 }
43
44 if (wifi.joinAP(SSID, PASSWORD)) {
45 Serial.print("Join AP success\r\n");
46 Serial.print("IP: ");
47 Serial.println(wifi.getLocalIP().c_str());
48 } else {
49 Serial.print("Join AP failure\r\n");
50 }
51
52 Serial.print("setup end\r\n");
53}
54
55void loop(void)
56{
57}
58
Note: See TracBrowser for help on using the repository browser.