当前位置:网站首页>基于Arduino和ESP8266的Blink代码运行成功(包含错误分析)
基于Arduino和ESP8266的Blink代码运行成功(包含错误分析)
2022-07-02 09:42:00 【每天默默学习】
硬件图片:
目前用了
1、ESP8266开发板
2、Arduino开发板

一、加载ESP8266WIFI.h库遇到的问题
直接在网上下载8266_package_3.0.2_arduinocn文件,我的是在CSDN上下载的
目前错误之一是由于我第一次调试ESP8266,所以病急乱投医,下载了三个版本的ESP8266
第一个2.6.3
第二个2.7.1
第三个3.0.2
我就都加载上了,结果编译一直说:库文件找不到,经过3个小时调试不知道错误
第二天我想是不是版本加载太多,就通过
工具-开发板-开发板管理器
搜索ESP8266,显示的3.0.2版本,我就卸载,然后又显示2.7.1版本,继续卸载,又显示2.6.3,继续卸载
卸载完后,重新安装3.0.2版本,结果显示库文件添加成功
到此解决了ESP8266WIFI.h库文件的添加工作
资源如下:
这是我自己摘出来的单独ESP8266:
具体资源也是我从网站C下来的
参考:Arduino框架的ESP8266和ESP32的SDK安装包截止2022年4月28日最新稳定版
具体的esp8266环境搭建,我直接推荐其他老师的博文:
具体的ESP8266的SDK可以直接用我的3.0.2版本,亲测可用
二、运行代码遇到的问题
库加载上了,可是编译,显示连接不上手机热点,很郁闷,又是调了3个小时,决定放到明天再C一下看看有没有办法解决:
第3天,换了一根数据线,把arduino的com口和esp8266com口选择同一个,调试就通过了,下面来具体讲解调试步骤。
错误视频如下:
ESP8266连接不上手机热点
三、基于ESP8266的Blink代码运行OK
经过3天的调试
ESP8266示例-blink代码测试成功
我们在搭建好ESP8266的Arduino环境后
我的电脑(右键)-管理-设备管理器
1)查看,我们的ESP8266为COM6口

插上Arduino后显示:
COM6为ESP8266口
COM7为Arduino口
这里,我的错误是我用的连ESP8266的线只能用来充电,换了一根数据线,就找到了COM6口,所以,一定要确定自己的ESP8266连接上电脑了

2)然后我们选择开发板选项,以下就是我的ArduinoIDE的设置

3)代码选择:
文件-示例-ESP8266-Blink
之后就是运行,这里有一个ESP8266的按键顺序:
1、我们先按住:flash,然后按一下RET,看见ESP8266的蓝灯亮了一下
2、一直按住flash,点击Arduino的下载,然后看见看见编译-connecting,一直按住,等待百分比超过100%,下载完成,然后松开flash,就可以看见我们的ESP8266开发板的蓝灯按照Blink代码里面的延迟亮灭时间在闪烁了
记住:Arduino也选COM6,这里是根据自己的ESP8266开发板的COM6来设定的
Blink代码:
/*
ESP8266 Blink by Simon Peter
Blink the blue LED on the ESP-01 module
This example code is in the public domain
The blue LED on the ESP-01 module is connected to GPIO1
(which is also the TXD pin; so we cannot use Serial.print() at the same time)
Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/
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(300); // Wait for a second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(300); // Wait for two seconds (to demonstrate the active low LED)
}4)运行成功视频:
基于Arduino和ESP8266的Blink运行成功视频
OK,基于Arduino和ESP8266的Blink运行和错误分析到此结束,希望大家学习得开心快乐。
边栏推荐
- BEAUTIFUL GGPLOT VENN DIAGRAM WITH R
- Principle of scalable contract delegatecall
- Three transparent LED displays that were "crowded" in 2022
- 基于Hardhat编写合约测试用例
- Log4j2
- PyTorch nn.RNN 参数全解析
- Develop scalable contracts based on hardhat and openzeppelin (II)
- PyTorch中repeat、tile与repeat_interleave的区别
- Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
- YYGH-BUG-04
猜你喜欢

HOW TO ADD P-VALUES TO GGPLOT FACETS

How to Easily Create Barplots with Error Bars in R

Take you ten days to easily finish the finale of go micro services (distributed transactions)

BEAUTIFUL GGPLOT VENN DIAGRAM WITH R
![[visual studio 2019] create and import cmake project](/img/51/6c2575030c5103aee6c02bec8d5e77.jpg)
[visual studio 2019] create and import cmake project

Esp32 audio frame esp-adf add key peripheral process code tracking

Filtre de profondeur de la série svo2

HOW TO ADD P-VALUES TO GGPLOT FACETS

Power Spectral Density Estimates Using FFT---MATLAB

GGHIGHLIGHT: EASY WAY TO HIGHLIGHT A GGPLOT IN R
随机推荐
2022年遭“挤爆”的三款透明LED显示屏
B high and beautiful code snippet sharing image generation
The position of the first underline selected by the vant tabs component is abnormal
Log4j2
Applet link generation
行業的分析
HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
K-Means Clustering Visualization in R: Step By Step Guide
Implementation of address book (file version)
K-Means Clustering Visualization in R: Step By Step Guide
What is the relationship between digital transformation of manufacturing industry and lean production
通讯录的实现(文件版本)
Thesis translation: 2022_ PACDNN: A phase-aware composite deep neural network for speech enhancement
Writing contract test cases based on hardhat
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
How to Visualize Missing Data in R using a Heatmap
基于Hardhat和Openzeppelin开发可升级合约(一)
Visualization of chip SEQ data by deeptools
[untitled] how to mount a hard disk in armbian
Uniapp uni list item @click, uniapp uni list item jump with parameters