当前位置:网站首页>Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 1 -- establishment of engineering template -template
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 1 -- establishment of engineering template -template
2022-07-03 09:28:00 【Taodream】
First, build the development environment :https://blog.csdn.net/felix_tao/article/details/113092886
First step : Build a new project .
1) Project name Name:template
2) Development board Board:NodeMCU 1.0(ESP-12E Module)
3) frame Framework:Arduino
The second step : Copy in routine Blink Code to src->main.cpp in .
1) find Blink Routine path C:\Users\felix\.platformio\packages\framework-arduinoespressif8266\libraries\esp8266\examples\Blink
2) Use Nodepad++ open , Copy the code inside to src->main.cpp in , Be careful :main.cpp Do not delete the header file in .
Blink Routine code :
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is active low on the ESP-01)
delay(1000); // Wait for a second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
}3) stay Blink Add serial port printing on the basis , The sorted code is as follows .
Macro definition #define LED_BUILTIN 2, It can be added or not , Because in pins_arduino.h There will also be definitions in .
Be careful : Macro definition added #define LED_BUILTIN 2, It is impossible to jump to the definition , Need to be commented out , To jump .
main.cpp Code :
#include <Arduino.h>
//#define LED_BUILTIN 2 //ESP-12E The module itself LED, Corresponding GPIO2, Low level light
//#define LED_BUILTIN 16 //nodemcu-esp8266 The development board extends LED, Corresponding GPIO16, Low level light
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);// Serial port baud rate configuration
pinMode(LED_BUILTIN, OUTPUT);// Set the pin to output mode
}
void loop()
{
// put your main code here, to run repeatedly:
Serial.print("Hello world!\r\n");// Serial printing
// control LED Light flashing
digitalWrite(LED_BUILTIN, HIGH);// close LED The lamp
delay(1000);
digitalWrite(LED_BUILTIN, LOW); // open LED The lamp
delay(1000);
}pins_arduino.h Code ( It doesn't need to be modified ):
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)
static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;
#ifndef LED_BUILTIN
#define LED_BUILTIN 2
#endif
#define LED_BUILTIN_AUX 16
static const uint8_t D0 = 16;
static const uint8_t D1 = 5;
static const uint8_t D2 = 4;
static const uint8_t D3 = 0;
static const uint8_t D4 = 2;
static const uint8_t D5 = 14;
static const uint8_t D6 = 12;
static const uint8_t D7 = 13;
static const uint8_t D8 = 15;
static const uint8_t D9 = 3;
static const uint8_t D10 = 1;
#include "../generic/common.h"
#endif /* Pins_Arduino_h */platformio.ini Code :
modify VSCODE Serial port monitor baud rate , Add the code :monitor_speed = 115200 #VSCODE Serial port monitor baud rate
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
monitor_speed = 115200 #VSCODE Serial port monitor baud rate The third step : compile 、 download 、 function .
1) After downloading the code successfully , You can see the LED Light flashing .
2)VSCODE Open the serial port monitor , You can see the print Hello world!.
Project source code download :https://download.csdn.net/download/felix_tao/14946368
边栏推荐
- Install database -linux-5.7
- Apply for domain name binding IP to open port 80 record
- C language programming specification
- Django operates Excel files through openpyxl to import data into the database in batches.
- LeetCode每日一题(2305. Fair Distribution of Cookies)
- Go language - Reflection
- CATIA automation object architecture - detailed explanation of application objects (III) systemservice
- Overview of database system
- 【Kotlin学习】类、对象和接口——带非默认构造方法或属性的类、数据类和类委托、object关键字
- 2022-2-13 learn the imitation Niuke project - Project debugging skills
猜你喜欢

Django operates Excel files through openpyxl to import data into the database in batches.

Jenkins learning (II) -- setting up Chinese

Hudi quick experience (including detailed operation steps and screenshots)
![[set theory] order relation (chain | anti chain | chain and anti chain example | chain and anti chain theorem | chain and anti chain inference | good order relation)](/img/fd/c0f885cdd17f1d13fdbc71b2aea641.jpg)
[set theory] order relation (chain | anti chain | chain and anti chain example | chain and anti chain theorem | chain and anti chain inference | good order relation)

PolyWorks script development learning notes (III) -treeview advanced operation
![[point cloud processing paper crazy reading classic version 11] - mining point cloud local structures by kernel correlation and graph pooling](/img/40/e0c7bad60b19cafa467c229419ac21.png)
[point cloud processing paper crazy reading classic version 11] - mining point cloud local structures by kernel correlation and graph pooling

Crawler career from scratch (II): crawl the photos of my little sister ② (the website has been disabled)

Using Hudi in idea
![[point cloud processing paper crazy reading classic version 9] - pointwise revolutionary neural networks](/img/ea/2c4336ee929c26c16627e5c0955704.png)
[point cloud processing paper crazy reading classic version 9] - pointwise revolutionary neural networks
![[point cloud processing paper crazy reading cutting-edge version 12] - adaptive graph revolution for point cloud analysis](/img/c6/5f723d9021cf684dcfb662ed3acaec.png)
[point cloud processing paper crazy reading cutting-edge version 12] - adaptive graph revolution for point cloud analysis
随机推荐
Common software open source protocols
小王叔叔的博客目录【持续更新中】
Crawler career from scratch (IV): climb the bullet curtain of station B through API
图像修复方法研究综述----论文笔记
Flink学习笔记(十)Flink容错机制
Jenkins learning (II) -- setting up Chinese
Basic knowledge of database design
[advanced feature learning on point clouds using multi resolution features and learning]
[point cloud processing paper crazy reading frontier version 11] - unsupervised point cloud pre training via occlusion completion
Liteide is easy to use
Install third-party libraries such as Jieba under Anaconda pytorch
制作jetson nano最基本的根文件系统、服务器挂载NFS文件系统
Win10安装ELK
Crawler career from scratch (V): detailed explanation of re regular expression
LeetCode每日一题(1024. Video Stitching)
NPM install installation dependency package error reporting solution
Filter comments to filter out uncommented and default values
ERROR: certificate common name “*.” doesn’t match requested ho
[set theory] order relation (chain | anti chain | chain and anti chain example | chain and anti chain theorem | chain and anti chain inference | good order relation)
Solve POM in idea Comment top line problem in XML file