当前位置:网站首页>基于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运行和错误分析到此结束,希望大家学习得开心快乐。
边栏推荐
- 行业的分析
- HOW TO CREATE A BEAUTIFUL INTERACTIVE HEATMAP IN R
- Natural language processing series (II) -- building character level language model using RNN
- 浅谈sklearn中的数据预处理
- R HISTOGRAM EXAMPLE QUICK REFERENCE
- Easyexcel and Lombok annotations and commonly used swagger annotations
- Fabric.js 3个api设置画布宽高
- How to Create a Nice Box and Whisker Plot in R
- 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
- Flesh-dect (media 2021) -- a viewpoint of material decomposition
猜你喜欢
Power Spectral Density Estimates Using FFT---MATLAB
How to Easily Create Barplots with Error Bars in R
GGPLOT: HOW TO DISPLAY THE LAST VALUE OF EACH LINE AS LABEL
[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
Some problems encountered in introducing lvgl into esp32 Arduino
GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
What is the relationship between digital transformation of manufacturing industry and lean production
ESP32 Arduino 引入LVGL 碰到的一些问题
PgSQL string is converted to array and associated with other tables, which are displayed in the original order after matching and splicing
ESP32存储配网信息+LED显示配网状态+按键清除配网信息(附源码)
随机推荐
Yygh-10-wechat payment
Research on and off the Oracle chain
小程序链接生成
Yygh-9-make an appointment to place an order
xss-labs-master靶场环境搭建与1-6关解题思路
GGPLOT: HOW TO DISPLAY THE LAST VALUE OF EACH LINE AS LABEL
php 根据经纬度查询距离
SVO2系列之深度濾波DepthFilter
文件操作(详解!)
Esp32 stores the distribution network information +led displays the distribution network status + press the key to clear the distribution network information (source code attached)
GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
HOW TO ADD P-VALUES TO GGPLOT FACETS
qt 仪表自定义控件
Principe du contrat évolutif - delegatecall
Some problems encountered in introducing lvgl into esp32 Arduino
6方面带你认识LED软膜屏 LED软膜屏尺寸|价格|安装|应用
Tiktok overseas tiktok: finalizing the final data security agreement with Biden government
K-Means Clustering Visualization in R: Step By Step Guide
自然语言处理系列(三)——LSTM
Bedtools tutorial