当前位置:网站首页>基于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运行和错误分析到此结束,希望大家学习得开心快乐。
边栏推荐
- H5,为页面添加遮罩层,实现类似于点击右上角在浏览器中打开
- Enter the top six! Boyun's sales ranking in China's cloud management software market continues to rise
- Principle of scalable contract delegatecall
- HOW TO CREATE A BEAUTIFUL INTERACTIVE HEATMAP IN R
- 自然语言处理系列(一)——RNN基础
- How to Create a Beautiful Plots in R with Summary Statistics Labels
- 机械臂速成小指南(七):机械臂位姿的描述方法
- How to Visualize Missing Data in R using a Heatmap
- How to Add P-Values onto Horizontal GGPLOTS
- GGPLOT: HOW TO DISPLAY THE LAST VALUE OF EACH LINE AS LABEL
猜你喜欢
Cluster Analysis in R Simplified and Enhanced
How to Add P-Values onto Horizontal GGPLOTS
6方面带你认识LED软膜屏 LED软膜屏尺寸|价格|安装|应用
pgsql 字符串转数组关联其他表,匹配 拼接后原顺序展示
Natural language processing series (II) -- building character level language model using RNN
How to Easily Create Barplots with Error Bars in R
R HISTOGRAM EXAMPLE QUICK REFERENCE
HOW TO CREATE A BEAUTIFUL INTERACTIVE HEATMAP IN R
机械臂速成小指南(七):机械臂位姿的描述方法
excel表格中选中单元格出现十字带阴影的选中效果
随机推荐
YYGH-10-微信支付
vant tabs组件选中第一个下划线位置异常
The position of the first underline selected by the vant tabs component is abnormal
基于Hardhat和Openzeppelin开发可升级合约(一)
Orb-slam2 data sharing and transmission between different threads
【2022 ACTF-wp】
H5, add a mask layer to the page, which is similar to clicking the upper right corner to open it in the browser
HOW TO ADD P-VALUES ONTO A GROUPED GGPLOT USING THE GGPUBR R PACKAGE
Analyse de l'industrie
【2022 ACTF-wp】
The computer screen is black for no reason, and the brightness cannot be adjusted.
Implementation of address book (file version)
Small guide for rapid formation of manipulator (VII): description method of position and posture of manipulator
Deep understanding of NN in pytorch Embedding
Log4j2
What week is a date obtained by QT
Writing contract test cases based on hardhat
行业的分析
YYGH-BUG-05
ESP32 Arduino 引入LVGL 碰到的一些问题