广州活力数据恢复中心

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1815|回复: 0

[esp8266 arduino]nodemcu wifi code

[复制链接]

92

主题

104

帖子

688

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
688
发表于 2020-8-9 11:14:46 | 显示全部楼层 |阅读模式
nodemcu wifi code




nodemcu esp8266有三种wifi模式:WIFI_AP, WIFI_STA,WIFI_AP_STA
通过修改WIFI.mode(WIFI_STA)来设置

WIFI_AP, WIFI_STA, WIFI_AP_STA or WIFI_OFF

  1. #include <Arduino.h>
  2. #include <ESP8266WiFi.h>
  3. #include <WiFiClient.h>
  4. #include <ESP8266WebServer.h>
  5. // ********** set wifi and bit rate ***************
  6. const char* ssid = "xxxxx"; //wifi SSID which you want to join
  7. const char* password = "xxxx"; //wifi password
  8. void light (int delaySecond){
  9.     delay ( delaySecond * 1000);
  10.   }
  11. void setup() {
  12.     // put your setup code here, to run once:
  13.     Serial.begin(921600);  //default bit rate
  14.     WiFi.mode(WIFI_STA); //set to STA mode
  15.     WiFi.begin(ssid, password); //connect to WiFi
  16.     Serial.println("ESP8266 module start!");
  17.     Serial.print("ESP8266 MAC: "); //show nodemcu mac address before connect to wifi. as some network env bond mac address
  18.     Serial.println(WiFi.macAddress()); //show nodemcu mac address
  19.     // Wait for connection
  20.     while (WiFi.status() != WL_CONNECTED) {
  21.     delay(500);
  22.     Serial.print(".");
  23.   }
  24.     // show info after connected!
  25.     Serial.println("");
  26.     Serial.print("Connected to ");
  27.     Serial.println(ssid);
  28.     Serial.print("IP address: ");
  29.     Serial.println(WiFi.localIP()); //show nodemcu ip address
复制代码



一体优盘数据恢复 www.rflashdata.com
硬盘ROM损坏焊爆丢失配ROM服务
buffalo 隨身碟數據救援 bitlocker WDV2 lacie EFS等加密硬盘数据恢复,指纹爱国者加密优盘数据恢复 +86 18620923827
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|硬盘FLASH数据恢复论坛

GMT+8, 2024-5-15 16:47 , Processed in 0.033932 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表