测试环境基于: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>
#define WIFINAME "belldandy"
#define WIFIPW "11223344"
void setup()
{
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()
{
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.
|