广州活力数据恢复中心

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1842|回复: 0

[esp8266]nodemcu esp8266 IOT开发板资料和教学

[复制链接]

92

主题

104

帖子

688

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
688
发表于 2020-7-19 09:36:16 | 显示全部楼层 |阅读模式
[esp8266]nodemcu esp8266 IOT开发板资料和教学
esplorer


esp-01


常用工具下载:
  1. esplorer
  2. https://esp8266.ru/esplorer/   


  3. esplorer需要jave7或者以上的版本
  4. https://www.java.com/en/download/


  5. ESP8266Flasher.exe刷固件软件
  6. https://github.com/nodemcu/nodemcu-flasher/raw/master/Win64/Release/ESP8266Flasher.exe

  7. nodemch pyflasher(macos & win)
  8. https://github.com/marcelstoer/nodemcu-pyflasher/releases/tag/v4.0

复制代码





有时候用usb线连接不了电脑,建议换根质量好点的USB线试, 有些USB线只接了地址和电源给设备充电用,并没有连接数据线!

Lua error: stdin:1: bad argument #1 to 'config' (config table not found!)

解决方法:
--connect to Access Point (DO NOT save config to flash)
station_cfg={}
station_cfg.ssid="NODE-AABBCC"
station_cfg.pwd="password"
wifi.sta.config(station_cfg)

--connect to Access Point (DO save config to flash)
station_cfg={}
station_cfg.ssid="NODE-AABBCC"
station_cfg.pwd="password"
station_cfg.save=true
wifi.sta.config(station_cfg)

--connect to Access Point with specific MAC address  
station_cfg={}
station_cfg.ssid="NODE-AABBCC"
station_cfg.pwd="password"
station_cfg.bssid="AA:BB:CC:DD:EE:FF"
wifi.sta.config(station_cfg)

--configure station but don't connect to Access point
station_cfg={}
station_cfg.ssid="NODE-AABBCC"
station_cfg.pwd="password"
station_cfg.auto=false
wifi.sta.config(station_cfg)





CH34XX芯片版本
  1. (base) VM:~ hello$ ll /dev/tty.*
  2. crw-rw-rw-  1 root  wheel   18,   4 Jul 19 15:45 /dev/tty.Bluetooth-Incoming-Port
  3. crw-rw-rw-  1 root  wheel   18,  16 Jul 19 16:18 /dev/tty.usbserial-14220
  4. crw-rw-rw-  1 root  wheel   18,  14 Jul 19 16:18 /dev/tty.wchusbserial14220     <-------选择这个
复制代码


arduino IDE安装 esp8266
  1. http://arduino.esp8266.com/stable/package_esp8266com_index.json
复制代码
然后在tools-->boards manager里面搜esp8266安装


设置wifi热点


  1. /* NodeMCU建立WiFi Access Point */

  2. #include <ESP8266WiFi.h>
  3. #include <WiFiClient.h>
  4. #include <ESP8266WebServer.h>

  5. /* 无线设置*/
  6. const char *ssid = "test ok"; //WiFi名称
  7. const char *password = "12345678"; //WiFi密码

  8. ESP8266WebServer server(80);

  9. /* 建立一个web server,任何连接到这个热点的设备
  10. * 可以通过浏览器访问http://192.168.4.1
  11. */
  12. void handleRoot() {
  13.   server.send(200, "text/html", "<h1>Hello from ESP8266 AP!</h1>");
  14. }
  15. void setup() {
  16.   delay(1000);
  17.   Serial.begin(921600);
  18.   Serial.println();
  19.   Serial.print("Configuring access point...");
  20.   /* You can remove the password parameter if you want the AP to be open. */
  21.   WiFi.softAP(ssid, password);

  22.   IPAddress myIP = WiFi.softAPIP();
  23.   Serial.print("AP IP address: ");
  24.   Serial.println(myIP);
  25.   server.on("/", handleRoot);
  26.   server.begin();
  27.   Serial.println("HTTP server started");
  28. }

  29. void loop() {
  30.   server.handleClient();
  31. }
复制代码



esp8266连接wifi设置

  1. #include <ESP8266WiFi.h>
  2. // ********** set wifi ***************
  3. const char* ssid = "你的ssid"; //wifi SSID which you want to join
  4. const char* password = "你的密码"; //wifi password

  5. void setup(void){
  6.   Serial.begin(115200);
  7.   WiFi.mode(WIFI_STA); //set to STA mode
  8.   WiFi.begin(ssid, password); //connect to WiFi
  9.   Serial.println("esp8266 module start");

  10.   // Wait for connection
  11.   while (WiFi.status() != WL_CONNECTED) {
  12.     delay(500);
  13.     Serial.print(".");
  14.   }
  15.   // show info after connected!
  16.   Serial.println("");
  17.   Serial.print("Connected to ");
  18.   Serial.println(ssid);
  19.   Serial.print("IP address: ");
  20.   Serial.println(WiFi.localIP()); //show nodemcu ip address
  21.   Serial.print("ESP8266 MAC: "); //show nodemcu mac address
  22.   Serial.println(WiFi.macAddress());
  23. }

  24. void loop(void){
  25. }
复制代码


wifi_set_macaddr:
ESP8266 无需设置 MAC 地址,芯片出厂时自带 MAC 地址,并保证其唯一性。有部分用户不想使用厂家的 MAC 地址,希望自定义 MAC 地址,因此提供了接口 wifi_set_macaddr。这个接口的设置不会保存到 Flash,开发者如有需要,需自行保存到 Flash。如果自定义 MAC 地址,需自行保证其唯一性。






本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-16 04:40 , Processed in 0.038442 second(s), 27 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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