esp01s烧录时出现错误-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 3256|回复: 1

[已解决] esp01s烧录时出现错误

[复制链接]
发表于 2021-4-7 09:00 | 显示全部楼层 |阅读模式
具体错误信息如下:
Arduino:1.8.13 (Windows Store 1.8.42.0) (Windows 10), 开发板:"Generic ESP8266 Module, 80 MHz, Flash, Enabled, All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, QIO (fast), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\GSM\src\GSM3SoftSerial.cpp:36:27: fatal error: avr/interrupt.h: No such file or directory


#include <avr/interrupt.h>
                           ^
compilation terminated.


exit status 1


为开发板 Generic ESP8266 Module 编译时出错。

程序是制作气象站的程序,太极创客的,不知道为什么会报错。0.96寸的oled也点不亮
主程序源码如下
新人,请各位不吝赐教啊
  1. #include <GSM.h>
  2. #include <GSM3CircularBuffer.h>
  3. #include <GSM3IO.h>
  4. #include <GSM3MobileAccessProvider.h>
  5. #include <GSM3MobileCellManagement.h>
  6. #include <GSM3MobileClientProvider.h>
  7. #include <GSM3MobileClientService.h>
  8. #include <GSM3MobileDataNetworkProvider.h>
  9. #include <GSM3MobileMockupProvider.h>
  10. #include <GSM3MobileNetworkProvider.h>
  11. #include <GSM3MobileNetworkRegistry.h>
  12. #include <GSM3MobileServerProvider.h>
  13. #include <GSM3MobileServerService.h>
  14. #include <GSM3MobileSMSProvider.h>
  15. #include <GSM3MobileVoiceProvider.h>
  16. #include <GSM3ShieldV1.h>
  17. #include <GSM3ShieldV1AccessProvider.h>
  18. #include <GSM3ShieldV1BandManagement.h>
  19. #include <GSM3ShieldV1BaseProvider.h>
  20. #include <GSM3ShieldV1CellManagement.h>
  21. #include <GSM3ShieldV1ClientProvider.h>
  22. #include <GSM3ShieldV1DataNetworkProvider.h>
  23. #include <GSM3ShieldV1DirectModemProvider.h>
  24. #include <GSM3ShieldV1ModemCore.h>
  25. #include <GSM3ShieldV1ModemVerification.h>
  26. #include <GSM3ShieldV1MultiClientProvider.h>
  27. #include <GSM3ShieldV1MultiServerProvider.h>
  28. #include <GSM3ShieldV1PinManagement.h>
  29. #include <GSM3ShieldV1ScanNetworks.h>
  30. #include <GSM3ShieldV1ServerProvider.h>
  31. #include <GSM3ShieldV1SMSProvider.h>
  32. #include <GSM3ShieldV1VoiceProvider.h>
  33. #include <GSM3SMSService.h>
  34. #include <GSM3SoftSerial.h>
  35. #include <GSM3VoiceCallService.h>

  36. #include <Arduino.h>
  37. #include <ESP8266WiFi.h>
  38. #include <ESP8266HTTPClient.h>

  39. #include <DNSServer.h>//密码直连将其三个库注释
  40. #include <ESP8266WebServer.h>
  41. #include <CustomWiFiManager.h>

  42. #include <time.h>                       
  43. #include <sys/time.h>                  
  44. #include <coredecls.h>      


  45. //#include "SH1106Wire.h"   //1.3寸用这个
  46. #include "SSD1306Wire.h"    //0.96寸用这个
  47. #include "OLEDDisplayUi.h"
  48. #include "HeFeng.h"
  49. #include "WeatherStationFonts.h"
  50. #include "WeatherStationImages.h"

  51. /***************************
  52.    Begin Settings
  53. **************************/

  54. const char* WIFI_SSID = "xiaokai";  //填写你的WIFI名称及密码
  55. const char* WIFI_PWD = "12345678k";

  56. const char* BILIBILIID = "167480182";  //填写你的B站账号

  57. //由于太多人使用我的秘钥,导致获取次数超额,所以不提供秘钥了,大家可以到https://dev.heweather.com/获取免费的
  58. const char* HEFENG_KEY = "xxxxxxxxxxxxxxxxxxxxxx";//填写你的和风天气秘钥
  59. const char* HEFENG_LOCATION = "CN101290703";//填写你的城市ID,可到https://where.heweather.com/index.html查询
  60. //const char* HEFENG_LOCATION = "auto_ip";//自动IP定位

  61. #define TZ              8      // 中国时区为8
  62. #define DST_MN          0      // 默认为0

  63. const int UPDATE_INTERVAL_SECS = 5 * 60; // 5分钟更新一次天气
  64. const int UPDATE_CURR_INTERVAL_SECS = 2 * 59; // 2分钟更新一次粉丝数

  65. const int I2C_DISPLAY_ADDRESS = 0x3c;  //I2c地址默认
  66. #if defined(ESP8266)
  67. const int SDA_PIN = 0;  //引脚连接
  68. const int SDC_PIN = 2;  //
  69. #endif

  70. const String WDAY_NAMES[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};  //星期
  71. const String MONTH_NAMES[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};  //月份

  72. // web配网页面自定义我的图标请随便使用一个图片转base64工具转换https://tool.css-js.com/base64.html, 64*64
  73. const char Icon[] PROGMEM = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAgAElEQVR4nMV7CZhcZZnu+5+lTu1bd1fvnU53p5POThaykRBADCCLIgpedcZxHQdHHQfQGdcZZ65cveOd5dHLiNs4ggMaRjYRUAmbCEnIQkIWspL0Wt3VtddZ//8+319VnUoTBhHmued5Tnetp/7/W9/v/b7Drn7nlTjnIQCmKAgEVJQqBSxYuBpfuunzcFwH5XIJjDHougotoGPHzp3QoGIiPYHHn3wc2WwW0WgUkUgEnHOFMTbX87zFdOq63u04ThJAE2MsDIAzxqYdx8koijIJ4DCA/Yyxg0KIcVVV4bouhBBQFAWMAR7nEJ4CAQZNA8aHx7Bly+X4kw9+EAqA7/7wdtz6T/8b7S1NYGDn3l/t0P7Ld1/nQUKpHUnG2NsYYxuFEBe7rjPXtm2lubkF+Xxefo42RP8dx4GmaTPfrb8nhLAAPM85fxLAQwAer6rlzT2UN+Nqtm1D13Toun6ZaZn/nkgkToTD4R85jv0RRWH9xVJZ2bz5Ygz0D6BYLIK0ShsljZJ2Pc+Dz+eTzznn8j3GmMEYW+c4zi2e5z3GGDvMGPs7AAveTAm8IQHQYmnRC4eG3pUv5X+7a/euh8Kh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ErkJggg==";

  74. /***************************
  75.    End Settings
  76. **************************/

  77. //SH1106Wire     display(I2C_DISPLAY_ADDRESS, SDA_PIN, SDC_PIN);   // 1.3寸用这个
  78. SSD1306Wire     display(I2C_DISPLAY_ADDRESS, SDA_PIN, SDC_PIN);   // 0.96寸用这个
  79. OLEDDisplayUi   ui( &display );

  80. HeFengCurrentData currentWeather; //实例化对象
  81. HeFengForeData foreWeather[3];
  82. HeFeng HeFengClient;

  83. #define TZ_MN           ((TZ)*60)   //时间换算
  84. #define TZ_SEC          ((TZ)*3600)
  85. #define DST_SEC         ((DST_MN)*60)

  86. time_t now; //实例化时间

  87. bool readyForWeatherUpdate = false; // 天气更新标志
  88. bool first = true;  //首次更新标志
  89. long timeSinceLastWUpdate = 0;    //上次更新后的时间
  90. long timeSinceLastCurrUpdate = 0;   //上次天气更新后的时间

  91. String fans = "-1"; //粉丝数

  92. void drawProgress(OLEDDisplay *display, int percentage, String label);   //提前声明函数
  93. void updateData(OLEDDisplay *display);
  94. void updateDatas(OLEDDisplay *display);
  95. void drawDateTime(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
  96. void drawCurrentWeather(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
  97. void drawForecast(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
  98. void drawForecastDetails(OLEDDisplay *display, int x, int y, int dayIndex);
  99. void drawHeaderOverlay(OLEDDisplay *display, OLEDDisplayUiState* state);
  100. void setReadyForWeatherUpdate();

  101. //添加框架
  102. //此数组保留指向所有帧的函数指针
  103. //框架是从右向左滑动的单个视图
  104. FrameCallback frames[] = { drawDateTime, drawCurrentWeather, drawForecast };
  105. //页面数量
  106. int numberOfFrames = 3;

  107. OverlayCallback overlays[] = { drawHeaderOverlay }; //覆盖回调函数
  108. int numberOfOverlays = 1;  //覆盖数

  109. void setup() {
  110.   Serial.begin(115200);
  111.   Serial.println();
  112.   Serial.println();

  113.   // 屏幕初始化
  114.   display.init();
  115.   display.clear();
  116.   display.display();

  117.   display.flipScreenVertically(); //屏幕翻转
  118.   display.setContrast(255); //屏幕亮度

  119.   //Web配网,密码直连请注释
  120.   webconnect();
  121.   
  122.   // 用固定密码连接,Web配网请注释
  123.   //wificonnect();

  124.   ui.setTargetFPS(30);  //刷新频率

  125.   ui.setActiveSymbol(activeSymbole); //设置活动符号
  126.   ui.setInactiveSymbol(inactiveSymbole); //设置非活动符号

  127.   // 符号位置
  128.   // 你可以把这个改成TOP, LEFT, BOTTOM, RIGHT
  129.   ui.setIndicatorPosition(BOTTOM);

  130.   // 定义第一帧在栏中的位置
  131.   ui.setIndicatorDirection(LEFT_RIGHT);

  132.   // 屏幕切换方向
  133.   // 您可以更改使用的屏幕切换方向 SLIDE_LEFT, SLIDE_RIGHT, SLIDE_TOP, SLIDE_DOWN
  134.   ui.setFrameAnimation(SLIDE_LEFT);

  135.   ui.setFrames(frames, numberOfFrames); // 设置框架
  136.   ui.setTimePerFrame(5000); //设置切换时间
  137.   
  138.   ui.setOverlays(overlays, numberOfOverlays); //设置覆盖

  139.   // UI负责初始化显示
  140.   ui.init();
  141.   display.flipScreenVertically(); //屏幕反转

  142.   configTime(TZ_SEC, DST_SEC, "ntp.ntsc.ac.cn", "ntp1.aliyun.com"); //ntp获取时间,你也可用其他"pool.ntp.org","0.cn.pool.ntp.org","1.cn.pool.ntp.org","ntp1.aliyun.com"
  143.   delay(200);

  144. }

  145. void loop() {
  146.   if (first) {  //首次加载
  147.     updateDatas(&display);
  148.     first = false;
  149.   }
  150.   if (millis() - timeSinceLastWUpdate > (1000L * UPDATE_INTERVAL_SECS)) { //屏幕刷新
  151.     setReadyForWeatherUpdate();
  152.     timeSinceLastWUpdate = millis();
  153.   }
  154.   if (millis() - timeSinceLastCurrUpdate > (1000L * UPDATE_CURR_INTERVAL_SECS)) { //粉丝数更新
  155.     HeFengClient.fans(¤tWeather, BILIBILIID);
  156.     fans = String(currentWeather.follower);
  157.     timeSinceLastCurrUpdate = millis();
  158.   }

  159.   if (readyForWeatherUpdate && ui.getUiState()->frameState == FIXED) { //天气更新
  160.     updateData(&display);
  161.   }

  162.   int remainingTimeBudget = ui.update(); //剩余时间预算

  163.   if (remainingTimeBudget > 0) {
  164.     //你可以在这里工作如果你低于你的时间预算。
  165.     delay(remainingTimeBudget);
  166.   }
  167.   
  168. }

  169. //void wificonnect() {  //WIFI密码连接,Web配网请注释
  170. //  WiFi.begin(WIFI_SSID, WIFI_PWD);
  171. //  while (WiFi.status() != WL_CONNECTED) {
  172. //    Serial.print('.');
  173. //    delay(80);
  174. //    display.clear();
  175. //    display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_5);
  176. //    display.display();
  177. //    delay(80);
  178. //    display.clear();
  179. //    display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_6);
  180. //    display.display();
  181. //    delay(80);
  182. //    display.clear();
  183. //    display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_7);
  184. //    display.display();
  185. //    delay(80);
  186. //    display.clear();
  187. //    display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_8);
  188. //    display.display();
  189. //    delay(80);
  190. //    display.clear();
  191. //    display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_1);
  192. //    display.display();
  193. //    delay(80);
  194. //    display.clear();
  195. //    display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_2);
  196. //    display.display();
  197. //    delay(80);
  198. //    display.clear();
  199. //    display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_3);
  200. //    display.display();
  201. //    delay(80);
  202. //    display.clear();
  203. //    display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_4);
  204. //    display.display();
  205. //  }
  206. //  Serial.println("");
  207. //  delay(500);
  208. //}

  209. void webconnect() {  ////Web配网,密码直连将其注释
  210.   display.clear();
  211.   display.drawXbm(0, 0, 128, 64, bilibili); //显示哔哩哔哩
  212.   display.display();

  213.   WiFiManager wifiManager;  //实例化WiFiManager
  214.   wifiManager.setDebugOutput(false); //关闭Debug
  215.   //wifiManager.setConnectTimeout(10); //设置超时
  216.   wifiManager.setHeadImgBase64(FPSTR(Icon)); //设置图标
  217.   wifiManager.setPageTitle("欢迎来到小凯的WiFi配置页");  //设置页标题

  218.   if (!wifiManager.autoConnect("XiaoKai-IOT-Display")) {  //AP模式
  219.     Serial.println("连接失败并超时");
  220.     //重新设置并再试一次,或者让它进入深度睡眠状态
  221.     ESP.restart();
  222.     delay(1000);
  223.   }
  224.   Serial.println("connected...^_^");
  225.   yield();
  226. }

  227. void drawProgress(OLEDDisplay *display, int percentage, String label) {    //绘制进度
  228.   display->clear();
  229.   display->setTextAlignment(TEXT_ALIGN_CENTER);
  230.   display->setFont(ArialMT_Plain_10);
  231.   display->drawString(64, 10, label);
  232.   display->drawProgressBar(2, 28, 124, 10, percentage);
  233.   display->display();
  234. }

  235. void updateData(OLEDDisplay *display) {  //天气更新
  236.   HeFengClient.doUpdateCurr(¤tWeather, HEFENG_KEY, HEFENG_LOCATION);
  237.   HeFengClient.doUpdateFore(foreWeather, HEFENG_KEY, HEFENG_LOCATION);
  238.   readyForWeatherUpdate = false;
  239. }

  240. void updateDatas(OLEDDisplay *display) {  //首次天气更新
  241.   drawProgress(display, 0, "Updating fansnumb...");
  242.   HeFengClient.fans(¤tWeather, BILIBILIID);
  243.   fans = String(currentWeather.follower);
  244.   
  245.   drawProgress(display, 33, "Updating weather...");
  246.   HeFengClient.doUpdateCurr(¤tWeather, HEFENG_KEY, HEFENG_LOCATION);
  247.   
  248.   drawProgress(display, 66, "Updating forecasts...");
  249.   HeFengClient.doUpdateFore(foreWeather, HEFENG_KEY, HEFENG_LOCATION);
  250.   
  251.   readyForWeatherUpdate = false;
  252.   drawProgress(display, 100, "Done...");
  253.   delay(200);
  254.   
  255. }

  256. void drawDateTime(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {  //显示时间
  257.   now = time(nullptr);
  258.   struct tm* timeInfo;
  259.   timeInfo = localtime(&now);
  260.   char buff[16];

  261.   display->setTextAlignment(TEXT_ALIGN_CENTER);
  262.   display->setFont(ArialMT_Plain_16);
  263.   String date = WDAY_NAMES[timeInfo->tm_wday];

  264.   sprintf_P(buff, PSTR("%04d-%02d-%02d  %s"), timeInfo->tm_year + 1900, timeInfo->tm_mon + 1, timeInfo->tm_mday, WDAY_NAMES[timeInfo->tm_wday].c_str());
  265.   display->drawString(64 + x, 5 + y, String(buff));
  266.   display->setFont(ArialMT_Plain_24);

  267.   sprintf_P(buff, PSTR("%02d:%02d:%02d"), timeInfo->tm_hour, timeInfo->tm_min, timeInfo->tm_sec);
  268.   display->drawString(64 + x, 22 + y, String(buff));
  269.   display->setTextAlignment(TEXT_ALIGN_LEFT);
  270. }

  271. void drawCurrentWeather(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {  //显示天气
  272.   display->setFont(ArialMT_Plain_10);
  273.   display->setTextAlignment(TEXT_ALIGN_CENTER);
  274.   display->drawString(64 + x, 38 + y, currentWeather.cond_txt + "    |   Wind: " + currentWeather.wind_sc + "  ");

  275.   display->setFont(ArialMT_Plain_24);
  276.   display->setTextAlignment(TEXT_ALIGN_LEFT);
  277.   String temp = currentWeather.tmp + "°C" ;
  278.   display->drawString(60 + x, 3 + y, temp);
  279.   display->setFont(ArialMT_Plain_10);
  280.   display->drawString(62 + x, 26 + y, currentWeather.fl + "°C | " + currentWeather.hum + "%");
  281.   display->setFont(Meteocons_Plain_36);
  282.   display->setTextAlignment(TEXT_ALIGN_CENTER);
  283.   display->drawString(32 + x, 0 + y, currentWeather.iconMeteoCon);
  284. }

  285. void drawForecast(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {  //天气预报
  286.   drawForecastDetails(display, x, y, 0);
  287.   drawForecastDetails(display, x + 44, y, 1);
  288.   drawForecastDetails(display, x + 88, y, 2);
  289. }

  290. void drawForecastDetails(OLEDDisplay *display, int x, int y, int dayIndex) {  //天气预报

  291.   display->setTextAlignment(TEXT_ALIGN_CENTER);
  292.   display->setFont(ArialMT_Plain_10);
  293.   display->drawString(x + 20, y, foreWeather[dayIndex].datestr);
  294.   display->setFont(Meteocons_Plain_21);
  295.   display->drawString(x + 20, y + 12, foreWeather[dayIndex].iconMeteoCon);

  296.   String temp = foreWeather[dayIndex].tmp_min + " | " + foreWeather[dayIndex].tmp_max;
  297.   display->setFont(ArialMT_Plain_10);
  298.   display->drawString(x + 20, y + 34, temp);
  299.   display->setTextAlignment(TEXT_ALIGN_LEFT);
  300. }

  301. void drawHeaderOverlay(OLEDDisplay *display, OLEDDisplayUiState* state) {   //绘图页眉覆盖
  302.   now = time(nullptr);
  303.   struct tm* timeInfo;
  304.   timeInfo = localtime(&now);
  305.   char buff[14];
  306.   sprintf_P(buff, PSTR("%02d:%02d"), timeInfo->tm_hour, timeInfo->tm_min);

  307.   display->setColor(WHITE);
  308.   display->setFont(ArialMT_Plain_10);
  309.   display->setTextAlignment(TEXT_ALIGN_LEFT);
  310.   display->drawString(6, 54, String(buff));
  311.   display->setTextAlignment(TEXT_ALIGN_RIGHT);
  312.   String temp = fans;
  313.   display->drawString(122, 54, temp);
  314.   display->drawHorizontalLine(0, 52, 128);
  315. }

  316. void setReadyForWeatherUpdate() {  //为天气更新做好准备
  317.   Serial.println("Setting readyForUpdate to true");
  318.   readyForWeatherUpdate = true;
  319. }
复制代码


部分代码行

部分代码行

已有库(部分)

已有库(部分)

错误图片

错误图片

设置

设置
发表于 2021-4-7 09:07 | 显示全部楼层
报错已经说明了,程序调用了avr的文件,所以不行。解决办法,找到对应的代码,读懂后改写成8266的即可
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-29 09:34 , Processed in 0.080667 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表