Created
May 22, 2016 11:48
-
-
Save bobchao/8288cd2e6375ae15e21d6319955eda6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "ESP8266.h" | |
| #include <SoftwareSerial.h> | |
| #define SSID "MozTW" | |
| #define PASSWORD "fox-mosa" | |
| SoftwareSerial mySerial(3, 2); // uno sw RX(pin3) --> esp8266 TX, uno sw TX(pin2) --> esp8266 RX | |
| ESP8266 wifi(mySerial); | |
| void setup(void) | |
| { | |
| Serial.begin(9600); | |
| Serial.print("setup begin\r\n"); | |
| Serial.print("Connecting to SSID "); | |
| Serial.println(SSID); | |
| Serial.print("FW Version: "); | |
| Serial.println(wifi.getVersion().c_str()); | |
| if (wifi.setOprToStation()) { | |
| Serial.print("to station ok\r\n"); | |
| } else { | |
| Serial.print("to station err\r\n"); | |
| } | |
| if (wifi.joinAP(SSID, PASSWORD)) { | |
| Serial.print("Join AP success\r\n"); | |
| Serial.print("IP: "); | |
| Serial.println(wifi.getLocalIP().c_str()); | |
| } else { | |
| Serial.print("Join AP failure\r\n"); | |
| } | |
| Serial.print("setup end\r\n"); | |
| } | |
| void loop(void) | |
| { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment