qq_37236315
qq_37236315
采纳率33.3%
2017-01-27 06:05 阅读 3.9k

Arduino UNO WiFi开发板问题

现有Arduino UNO WiFi开发版,已经连上了Wi-Fi,但是写的程序却无法连接Wi-Fi,一直返回连接错误。

代码如下:

#include
#include

int pin = 8; //0~13

//wifi密码及ssid
char ssid[] = "Abc";
char password[] = "12345678";

//目标服务器ip即端口号
const IPAddress server(192,168,0,103);
const int tcpPort = 25000;
int status = WL_IDLE_STATUS;

WiFiClient client; //client端

void setup()
{

Serial.begin(9600);
Serial.println("Attempting to connect to WPA network...");
Serial.print("SSID: ");
Serial.println(ssid);

int status = WiFi.begin(ssid, password);
while(status != WL_CONNECTED)
{
Serial.println(WL_CONNECT_FAILED);
}

while(!client.connect(server, tcpPort))
{
Serial.println("Couldn't connect server");
}

}

void loop()
{

client.println("1");

}

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

相关推荐