当前位置:网站首页>基于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运行和错误分析到此结束,希望大家学习得开心快乐。
边栏推荐
- Principe du contrat évolutif - delegatecall
- PHP query distance according to longitude and latitude
- HOW TO EASILY CREATE BARPLOTS WITH ERROR BARS IN R
- Industry analysis
- GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
- Orb-slam2 data sharing and transmission between different threads
- Principle of scalable contract delegatecall
- 基于Hardhat编写合约测试用例
- 小程序链接生成
- PgSQL string is converted to array and associated with other tables, which are displayed in the original order after matching and splicing
猜你喜欢

R HISTOGRAM EXAMPLE QUICK REFERENCE

小程序链接生成

How to Create a Nice Box and Whisker Plot in R

How to Add P-Values onto Horizontal GGPLOTS

揭露数据不一致的利器 —— 实时核对系统

File operation (detailed!)

Pytorch builds LSTM to realize clothing classification (fashionmnist)

Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer

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
How to Visualize Missing Data in R using a Heatmap
动态内存(进阶四)
Cmake cross compilation
HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
Pyqt5+opencv project practice: microcirculator pictures, video recording and manual comparison software (with source code)
Repeat, tile and repeat in pytorch_ The difference between interleave
可升级合约的原理-DelegateCall
ORB-SLAM2不同线程间的数据共享与传递
ESP32 Arduino 引入LVGL 碰到的一些问题
ESP32存储配网信息+LED显示配网状态+按键清除配网信息(附源码)
What is the relationship between digital transformation of manufacturing industry and lean production
GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
Uniapp uni list item @click, uniapp uni list item jump with parameters
Develop scalable contracts based on hardhat and openzeppelin (II)
Esp32 audio frame esp-adf add key peripheral process code tracking
Principle of scalable contract delegatecall
vant tabs组件选中第一个下划线位置异常
php 根据经纬度查询距离
HOW TO CREATE A BEAUTIFUL INTERACTIVE HEATMAP IN R