当前位置:网站首页>基于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运行和错误分析到此结束,希望大家学习得开心快乐。
边栏推荐
- Summary of flutter problems
- GGPLOT: HOW TO DISPLAY THE LAST VALUE OF EACH LINE AS LABEL
- Esp32 audio frame esp-adf add key peripheral process code tracking
- php 根据经纬度查询距离
- Cluster Analysis in R Simplified and Enhanced
- Natural language processing series (II) -- building character level language model using RNN
- PyTorch搭建LSTM实现服装分类(FashionMNIST)
- 【多线程】主线程等待子线程执行完毕在执行并获取执行结果的方式记录(有注解代码无坑)
- YYGH-10-微信支付
- How to Create a Nice Box and Whisker Plot in R
猜你喜欢
文件操作(详解!)
Seriation in R: How to Optimally Order Objects in a Data Matrice
GGHIGHLIGHT: EASY WAY TO HIGHLIGHT A GGPLOT IN R
HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
Power Spectral Density Estimates Using FFT---MATLAB
自然语言处理系列(一)——RNN基础
Mmrotate rotation target detection framework usage record
Flesh-dect (media 2021) -- a viewpoint of material decomposition
Power Spectral Density Estimates Using FFT---MATLAB
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
随机推荐
MySQL stored procedure cursor traversal result set
自然语言处理系列(三)——LSTM
ESP32存储配网信息+LED显示配网状态+按键清除配网信息(附源码)
Flesh-dect (media 2021) -- a viewpoint of material decomposition
to_bytes与from_bytes简单示例
php 二维、多维 数组打乱顺序,PHP_php打乱数组二维数组多维数组的简单实例,php中的shuffle函数只能打乱一维
[visual studio 2019] create MFC desktop program (install MFC development components | create MFC application | edit MFC application window | add click event for button | Modify button text | open appl
HOW TO ADD P-VALUES ONTO A GROUPED GGPLOT USING THE GGPUBR R PACKAGE
Analyse de l'industrie
File operation (detailed!)
PHP 2D and multidimensional arrays are out of order, PHP_ PHP scrambles a simple example of a two-dimensional array and a multi-dimensional array. The shuffle function in PHP can only scramble one-dim
HOW TO ADD P-VALUES TO GGPLOT FACETS
B high and beautiful code snippet sharing image generation
GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
R HISTOGRAM EXAMPLE QUICK REFERENCE
SVO2系列之深度濾波DepthFilter
Dynamic debugging of multi file program x32dbg
Seriation in R: How to Optimally Order Objects in a Data Matrice
Principe du contrat évolutif - delegatecall