IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 开发工具 -> nodeMcu(esp8266)连接wifi(2.4G)(vscode+platformIO) -> 正文阅读

[开发工具]nodeMcu(esp8266)连接wifi(2.4G)(vscode+platformIO)


测试环境基于:vscode+platformIO IDE平台
( a awsome tool to develop almost all embedded boards)

testCode

the libraries:

  • <ESP8266WiFi.h>
  • <Arduino.h>

the funcitons:

  • WiFi.begin()
  • WiFi.status()
  • WiFi.localIP()
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
//#include <ESP8266HTTPClient.h>
//设置两个宏定义用于WiFi名和密码(修改为自身环境(比手机热点wifi)
#define WIFINAME "belldandy"
#define WIFIPW "11223344"
// nodemcu只能够链接到2.4G频段的wifi(或者说,默认是连不到5Ghz的WiFi的,这一点要注意!)
void setup()
{
    // put your setup code here, to run once:
    pinMode(LED_BUILTIN, OUTPUT);
    Serial.begin(115200);
    Serial.println("");
    WiFi.begin(WIFINAME, WIFIPW);
    Serial.print("Connecting wifi..");
    while (WiFi.status() != WL_CONNECTED)
    {
        delay(500);
        Serial.print(".");
    }
    Serial.println();
    Serial.print("Connected,IP Address:");
    Serial.println(WiFi.localIP());
}

void loop()
{
    // put your main code here, to run repeatedly:
    Serial.println("in loop()");
    delay(1e4);
}

platformIO bring you a brand embedded development experience.
在这里插入图片描述

process(build and upload)

Executing task in folder IOT: C:\Users\cxxu.platformio\penv\Scripts\platformio.exe run --target upload <

Processing nodemcuv2 (platform: espressif8266; board: nodemcuv2; framework: arduino)
--------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 (3.2.0) > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:

  • framework-arduinoespressif8266 3.30002.0 (3.0.2)
  • tool-esptool 1.413.0 (4.13)
  • tool-esptoolpy 1.30000.201119 (3.0.0)
  • tool-mklittlefs 1.203.210628 (2.3)
  • tool-mkspiffs 1.200.0 (2.0)
  • toolchain-xtensa 2.100300.210717 (10.3.0)
    LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 40 compatible libraries
    Scanning dependencies…
    Dependency Graph
    |-- 3.1.0
    |-- 6.18.4
    |-- 1.2
    | |-- 1.0
    |-- 1.0
    Building in release mode
    Retrieving maximum program size .pio\build\nodemcuv2\firmware.elf
    Checking size .pio\build\nodemcuv2\firmware.elf
    Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
    RAM: [=== ] 34.3% (used 28136 bytes from 81920 bytes)
    Flash: [=== ] 25.7% (used 267973 bytes from 1044464 bytes)
    Configuring upload protocol…
    AVAILABLE: espota, esptool
    CURRENT: upload_protocol = esptool
    Looking for upload port…
    Auto-detected: COM3
    Uploading .pio\build\nodemcuv2\firmware.bin
    esptool.py v3.0
    Serial port COM3
    Connecting…
    Chip is ESP8266EX
    Features: WiFi
    Crystal is 26MHz
    MAC: e8:db:84:9c:47:bd
    Uploading stub…
    Running stub…
    Stub running…
    Configuring flash size…
    Compressed 272128 bytes to 199704…
    Writing at 0x00000000… (7 %)
    Writing at 0x00004000… (15 %)
    Writing at 0x00008000… (23 %)
    Writing at 0x0000c000… (30 %)
    Writing at 0x00010000… (38 %)
    Writing at 0x00014000… (46 %)
    Writing at 0x00018000… (53 %)
    Writing at 0x0001c000… (61 %)
    Writing at 0x00020000… (69 %)
    Writing at 0x00024000… (76 %)
    Writing at 0x00028000… (84 %)
    Writing at 0x0002c000… (92 %)
    Writing at 0x00030000… (100 %)
    Wrote 272128 bytes (199704 compressed) at 0x00000000 in 17.9 seconds (effective
    121.7 kbit/s)…
    Hash of data verified.

Leaving…
Hard resetting via RTS pin…
========================= [SUCCESS] Took 25.99 seconds =========================
Terminal will be reused by tasks, press any key to close it.

Executing task in folder IOT: C:\Users\cxxu.platformio\penv\Scripts\platformio.exe run --target upload <

Processing nodemcuv2 (platform: espressif8266; board: nodemcuv2; framework: arduino)
--------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 (3.2.0) > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:

  • framework-arduinoespressif8266 3.30002.0 (3.0.2)
  • tool-esptool 1.413.0 (4.13)
  • tool-esptoolpy 1.30000.201119 (3.0.0)
  • tool-mklittlefs 1.203.210628 (2.3)
  • tool-mkspiffs 1.200.0 (2.0)
  • toolchain-xtensa 2.100300.210717 (10.3.0)
    LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 40 compatible libraries
    Scanning dependencies…
    Dependency Graph
    |-- 3.1.0
    |-- 6.18.4
    |-- 1.2
    | |-- 1.0
    |-- 1.0
    Building in release mode
    Compiling .pio\build\nodemcuv2\src\wifi_connect.cpp.o
    Linking .pio\build\nodemcuv2\firmware.elf
    Retrieving maximum program size .pio\build\nodemcuv2\firmware.elf
    Checking size .pio\build\nodemcuv2\firmware.elf
    Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
    RAM: [=== ] 34.3% (used 28136 bytes from 81920 bytes)
    Flash: [=== ] 25.7% (used 267989 bytes from 1044464 bytes)
    Building .pio\build\nodemcuv2\firmware.bin
    Creating BIN file “.pio\build\nodemcuv2\firmware.bin” using “C:\Users\cxxu.platformio\packages\framework-arduinoespressif8266\bootloaders\eboot\eboot.elf” and
    “.pio\build\nodemcuv2\firmware.elf”
    Configuring upload protocol…
    AVAILABLE: espota, esptool
    CURRENT: upload_protocol = esptool
    Looking for upload port…
    Auto-detected: COM3
    Uploading .pio\build\nodemcuv2\firmware.bin
    esptool.py v3.0
    Serial port COM3
    Connecting…
    Chip is ESP8266EX
    Features: WiFi
    Crystal is 26MHz
    MAC: e8:db:84:9c:47:bd
    Uploading stub…
    Running stub…
    Stub running…
    Configuring flash size…
    Compressed 272144 bytes to 199703…
    Writing at 0x00000000… (7 %)
    Writing at 0x00004000… (15 %)
    Writing at 0x00008000… (23 %)
    Writing at 0x0000c000… (30 %)
    Writing at 0x00010000… (38 %)
    Writing at 0x00014000… (46 %)
    Writing at 0x00018000… (53 %)
    Writing at 0x0001c000… (61 %)
    Writing at 0x00020000… (69 %)
    Writing at 0x00024000… (76 %)
    Writing at 0x00028000… (84 %)
    Writing at 0x0002c000… (92 %)
    Writing at 0x00030000… (100 %)
    Wrote 272144 bytes (199703 compressed) at 0x00000000 in 17.9 seconds (effective
    121.9 kbit/s)…
    Hash of data verified.

Leaving…
Hard resetting via RTS pin…
========================= [SUCCESS] Took 29.38 seconds =========================
Terminal will be reused by tasks, press any key to close it.

  开发工具 最新文章
Postman接口测试之Mock快速入门
ASCII码空格替换查表_最全ASCII码对照表0-2
如何使用 ssh 建立 socks 代理
Typora配合PicGo阿里云图床配置
SoapUI、Jmeter、Postman三种接口测试工具的
github用相对路径显示图片_GitHub 中 readm
Windows编译g2o及其g2o viewer
解决jupyter notebook无法连接/ jupyter连接
Git恢复到之前版本
VScode常用快捷键
上一篇文章      下一篇文章      查看所有文章
加:2021-09-29 10:30:38  更:2021-09-29 10:32:33 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年12日历 -2024/12/23 9:45:16-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码
数据统计