我无法使用arduino成功连接到8266 wifi模块

时间:2017-02-22 18:25:10

标签: arduino android-wifi esp8266

您好我是arduino编程的新手,我有一个问题。我已成功设法使用esp8266模块显示wifi,即当我运行我的代码esp8266模块创建一个wifi。它还要求输入密码,但之后没有成功连接的输出。我使用wifi.softAp(用户名,密码)的方法来创建wifi网络。我写了以下代码:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

const char* ssid = "Jeet";//Wifi username
const char* password = "wifibin12"; //Wifi password

ESP8266WebServer server(80);

void handleRoot() {
  server.send(200, "text/plain", "<h1>hello from esp8266!</h1>");
}

void setup(void) {
  // put your setup code here, to run once:

Serial.begin(115200);
//WiFi.mode(WIFI_AP);
Serial.print("this is my pass");
Serial.print(password);
WiFi.softAP(ssid, password);
Serial.print("Setting soft-Ap ... ");
// Wait for connection

while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }


//If connection successful show IP address in serial monitor
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());  //IP address assigned to your ESP

  server.on("/", handleRoot);      //Which routine to handle at root location

  server.begin();                  //Start server
  Serial.println("HTTP server started");

}

void loop() {
  // put your main code here, to run repeatedly:
server.handleClient();
}

当我运行代码时,我在串行监视器上连续输出.............如果有人知道我做错了什么,请帮助我解决这个问题。建议也将不胜感激。

0 个答案:

没有答案