具体错误信息如下:
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也点不亮
主程序源码如下
新人,请各位不吝赐教啊
- #include <GSM.h>
- #include <GSM3CircularBuffer.h>
- #include <GSM3IO.h>
- #include <GSM3MobileAccessProvider.h>
- #include <GSM3MobileCellManagement.h>
- #include <GSM3MobileClientProvider.h>
- #include <GSM3MobileClientService.h>
- #include <GSM3MobileDataNetworkProvider.h>
- #include <GSM3MobileMockupProvider.h>
- #include <GSM3MobileNetworkProvider.h>
- #include <GSM3MobileNetworkRegistry.h>
- #include <GSM3MobileServerProvider.h>
- #include <GSM3MobileServerService.h>
- #include <GSM3MobileSMSProvider.h>
- #include <GSM3MobileVoiceProvider.h>
- #include <GSM3ShieldV1.h>
- #include <GSM3ShieldV1AccessProvider.h>
- #include <GSM3ShieldV1BandManagement.h>
- #include <GSM3ShieldV1BaseProvider.h>
- #include <GSM3ShieldV1CellManagement.h>
- #include <GSM3ShieldV1ClientProvider.h>
- #include <GSM3ShieldV1DataNetworkProvider.h>
- #include <GSM3ShieldV1DirectModemProvider.h>
- #include <GSM3ShieldV1ModemCore.h>
- #include <GSM3ShieldV1ModemVerification.h>
- #include <GSM3ShieldV1MultiClientProvider.h>
- #include <GSM3ShieldV1MultiServerProvider.h>
- #include <GSM3ShieldV1PinManagement.h>
- #include <GSM3ShieldV1ScanNetworks.h>
- #include <GSM3ShieldV1ServerProvider.h>
- #include <GSM3ShieldV1SMSProvider.h>
- #include <GSM3ShieldV1VoiceProvider.h>
- #include <GSM3SMSService.h>
- #include <GSM3SoftSerial.h>
- #include <GSM3VoiceCallService.h>
- #include <Arduino.h>
- #include <ESP8266WiFi.h>
- #include <ESP8266HTTPClient.h>
- #include <DNSServer.h>//密码直连将其三个库注释
- #include <ESP8266WebServer.h>
- #include <CustomWiFiManager.h>
- #include <time.h>
- #include <sys/time.h>
- #include <coredecls.h>
- //#include "SH1106Wire.h" //1.3寸用这个
- #include "SSD1306Wire.h" //0.96寸用这个
- #include "OLEDDisplayUi.h"
- #include "HeFeng.h"
- #include "WeatherStationFonts.h"
- #include "WeatherStationImages.h"
- /***************************
- Begin Settings
- **************************/
- const char* WIFI_SSID = "xiaokai"; //填写你的WIFI名称及密码
- const char* WIFI_PWD = "12345678k";
- const char* BILIBILIID = "167480182"; //填写你的B站账号
- //由于太多人使用我的秘钥,导致获取次数超额,所以不提供秘钥了,大家可以到https://dev.heweather.com/获取免费的
- const char* HEFENG_KEY = "xxxxxxxxxxxxxxxxxxxxxx";//填写你的和风天气秘钥
- const char* HEFENG_LOCATION = "CN101290703";//填写你的城市ID,可到https://where.heweather.com/index.html查询
- //const char* HEFENG_LOCATION = "auto_ip";//自动IP定位
- #define TZ 8 // 中国时区为8
- #define DST_MN 0 // 默认为0
- const int UPDATE_INTERVAL_SECS = 5 * 60; // 5分钟更新一次天气
- const int UPDATE_CURR_INTERVAL_SECS = 2 * 59; // 2分钟更新一次粉丝数
- const int I2C_DISPLAY_ADDRESS = 0x3c; //I2c地址默认
- #if defined(ESP8266)
- const int SDA_PIN = 0; //引脚连接
- const int SDC_PIN = 2; //
- #endif
- const String WDAY_NAMES[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; //星期
- const String MONTH_NAMES[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; //月份
- // web配网页面自定义我的图标请随便使用一个图片转base64工具转换https://tool.css-js.com/base64.html, 64*64
- 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/euh8Kh8PtisViElGVZFnw+P+b1L8SmCy7B2PikdItGkyYLoNdisRj8fr8UJn2P3qODXqPH09PTA47jfF5R1AOC4w4hxKr/rwIgrYXD4bcwxp7Yv2//3b/Z9ti68fQ4QqEQTMvE5NQkli5bho7OLmzcuB6OY8Gn63JDpVIJhmFIIdCGSfuJRBxDQwsQi0XBFHINWwoqn89iyZIluOqqK6WwxsfH4fNp/4Mp2M4gvgug/Y14xh8kAM55IJFI/N9iqfjoXXfdtfHhRx7B1GQara2tYExBpVRBZ1sXLty4Gd2dXVi0eDEmJieRbGqC329IF6BASRuv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J+95Yt4esfzcqZI0QwUc8XaWBuXswUSa9TSKwk2FA5Xo3cNglPKrcXofwGwhirb17On133PEAMOcAWrBcOtFEDqU2VVV6kOTtFrNBZPk59kEVQcUcS3K1QsuWDcRdDWUMhloASD6G5thShbMuoXbBdFy4RF052aKocm6mM4xDD7DaO6cKoJNBWuyo5DYVdD4JOvdy9/kAAajr8CsK52V+eMGxDXJao3V0nB0G1yVSDjl7fc+g1ftQuSdDEAAAFtSURBVHQuWxLaUitMq05hSM6fyli6lYa07a9h+jr4ovccz5XX5sJzhRBfB7BUAPf/oZt4o3eO/g7AFfLk/BEySmJ5bNOU9wiSRdBEOcUBGlqk8XeyDJr+yhfyCPv90DUFJqVNxuRwkwx8tXsJvRr0ZrVRd4nxuSh7Qnzb9bwhCPFZGhR9Ixt4U26drVnBFuZ66wOK9i1FiDFKglZt/pfuDKWhSjpcVUfB4nJ6JNSUhEn1P/fkpiXGdxw55l5HnThTyu7UuLhZF6xfMNwIxo68GQt/U2+eFgLPqJr2jGdbf8kc51IusLnsOJsjkchCz/MCRFeF4zG4zMWzB/fj1PQEToyNoy3RBJ+qYDqblVGeBGBZ1hRZmM/ne4pz/pAA9ojXvBf89R9vqgCqQpAh2QLYA4B4gJ47jtMUiUSWZtLp1U65srirqyv1rz/+Yci1bb25tVvAhgnuFSqV8slEIrGr1qt4iTFWHUr+7zoA/D+DO3GxdL4whQAAAABJRU5ErkJggg==";
- /***************************
- End Settings
- **************************/
-
- //SH1106Wire display(I2C_DISPLAY_ADDRESS, SDA_PIN, SDC_PIN); // 1.3寸用这个
- SSD1306Wire display(I2C_DISPLAY_ADDRESS, SDA_PIN, SDC_PIN); // 0.96寸用这个
- OLEDDisplayUi ui( &display );
- HeFengCurrentData currentWeather; //实例化对象
- HeFengForeData foreWeather[3];
- HeFeng HeFengClient;
- #define TZ_MN ((TZ)*60) //时间换算
- #define TZ_SEC ((TZ)*3600)
- #define DST_SEC ((DST_MN)*60)
- time_t now; //实例化时间
- bool readyForWeatherUpdate = false; // 天气更新标志
- bool first = true; //首次更新标志
- long timeSinceLastWUpdate = 0; //上次更新后的时间
- long timeSinceLastCurrUpdate = 0; //上次天气更新后的时间
- String fans = "-1"; //粉丝数
- void drawProgress(OLEDDisplay *display, int percentage, String label); //提前声明函数
- void updateData(OLEDDisplay *display);
- void updateDatas(OLEDDisplay *display);
- void drawDateTime(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
- void drawCurrentWeather(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
- void drawForecast(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
- void drawForecastDetails(OLEDDisplay *display, int x, int y, int dayIndex);
- void drawHeaderOverlay(OLEDDisplay *display, OLEDDisplayUiState* state);
- void setReadyForWeatherUpdate();
- //添加框架
- //此数组保留指向所有帧的函数指针
- //框架是从右向左滑动的单个视图
- FrameCallback frames[] = { drawDateTime, drawCurrentWeather, drawForecast };
- //页面数量
- int numberOfFrames = 3;
- OverlayCallback overlays[] = { drawHeaderOverlay }; //覆盖回调函数
- int numberOfOverlays = 1; //覆盖数
- void setup() {
- Serial.begin(115200);
- Serial.println();
- Serial.println();
- // 屏幕初始化
- display.init();
- display.clear();
- display.display();
- display.flipScreenVertically(); //屏幕翻转
- display.setContrast(255); //屏幕亮度
- //Web配网,密码直连请注释
- webconnect();
-
- // 用固定密码连接,Web配网请注释
- //wificonnect();
- ui.setTargetFPS(30); //刷新频率
- ui.setActiveSymbol(activeSymbole); //设置活动符号
- ui.setInactiveSymbol(inactiveSymbole); //设置非活动符号
- // 符号位置
- // 你可以把这个改成TOP, LEFT, BOTTOM, RIGHT
- ui.setIndicatorPosition(BOTTOM);
- // 定义第一帧在栏中的位置
- ui.setIndicatorDirection(LEFT_RIGHT);
- // 屏幕切换方向
- // 您可以更改使用的屏幕切换方向 SLIDE_LEFT, SLIDE_RIGHT, SLIDE_TOP, SLIDE_DOWN
- ui.setFrameAnimation(SLIDE_LEFT);
- ui.setFrames(frames, numberOfFrames); // 设置框架
- ui.setTimePerFrame(5000); //设置切换时间
-
- ui.setOverlays(overlays, numberOfOverlays); //设置覆盖
- // UI负责初始化显示
- ui.init();
- display.flipScreenVertically(); //屏幕反转
- 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"
- delay(200);
- }
- void loop() {
- if (first) { //首次加载
- updateDatas(&display);
- first = false;
- }
- if (millis() - timeSinceLastWUpdate > (1000L * UPDATE_INTERVAL_SECS)) { //屏幕刷新
- setReadyForWeatherUpdate();
- timeSinceLastWUpdate = millis();
- }
- if (millis() - timeSinceLastCurrUpdate > (1000L * UPDATE_CURR_INTERVAL_SECS)) { //粉丝数更新
- HeFengClient.fans(¤tWeather, BILIBILIID);
- fans = String(currentWeather.follower);
- timeSinceLastCurrUpdate = millis();
- }
- if (readyForWeatherUpdate && ui.getUiState()->frameState == FIXED) { //天气更新
- updateData(&display);
- }
- int remainingTimeBudget = ui.update(); //剩余时间预算
- if (remainingTimeBudget > 0) {
- //你可以在这里工作如果你低于你的时间预算。
- delay(remainingTimeBudget);
- }
-
- }
- //void wificonnect() { //WIFI密码连接,Web配网请注释
- // WiFi.begin(WIFI_SSID, WIFI_PWD);
- // while (WiFi.status() != WL_CONNECTED) {
- // Serial.print('.');
- // delay(80);
- // display.clear();
- // display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_5);
- // display.display();
- // delay(80);
- // display.clear();
- // display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_6);
- // display.display();
- // delay(80);
- // display.clear();
- // display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_7);
- // display.display();
- // delay(80);
- // display.clear();
- // display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_8);
- // display.display();
- // delay(80);
- // display.clear();
- // display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_1);
- // display.display();
- // delay(80);
- // display.clear();
- // display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_2);
- // display.display();
- // delay(80);
- // display.clear();
- // display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_3);
- // display.display();
- // delay(80);
- // display.clear();
- // display.drawXbm(34, 0, bili_Logo_width, bili_Logo_height, bili_Logo_4);
- // display.display();
- // }
- // Serial.println("");
- // delay(500);
- //}
- void webconnect() { ////Web配网,密码直连将其注释
- display.clear();
- display.drawXbm(0, 0, 128, 64, bilibili); //显示哔哩哔哩
- display.display();
- WiFiManager wifiManager; //实例化WiFiManager
- wifiManager.setDebugOutput(false); //关闭Debug
- //wifiManager.setConnectTimeout(10); //设置超时
- wifiManager.setHeadImgBase64(FPSTR(Icon)); //设置图标
- wifiManager.setPageTitle("欢迎来到小凯的WiFi配置页"); //设置页标题
- if (!wifiManager.autoConnect("XiaoKai-IOT-Display")) { //AP模式
- Serial.println("连接失败并超时");
- //重新设置并再试一次,或者让它进入深度睡眠状态
- ESP.restart();
- delay(1000);
- }
- Serial.println("connected...^_^");
- yield();
- }
- void drawProgress(OLEDDisplay *display, int percentage, String label) { //绘制进度
- display->clear();
- display->setTextAlignment(TEXT_ALIGN_CENTER);
- display->setFont(ArialMT_Plain_10);
- display->drawString(64, 10, label);
- display->drawProgressBar(2, 28, 124, 10, percentage);
- display->display();
- }
- void updateData(OLEDDisplay *display) { //天气更新
- HeFengClient.doUpdateCurr(¤tWeather, HEFENG_KEY, HEFENG_LOCATION);
- HeFengClient.doUpdateFore(foreWeather, HEFENG_KEY, HEFENG_LOCATION);
- readyForWeatherUpdate = false;
- }
- void updateDatas(OLEDDisplay *display) { //首次天气更新
- drawProgress(display, 0, "Updating fansnumb...");
- HeFengClient.fans(¤tWeather, BILIBILIID);
- fans = String(currentWeather.follower);
-
- drawProgress(display, 33, "Updating weather...");
- HeFengClient.doUpdateCurr(¤tWeather, HEFENG_KEY, HEFENG_LOCATION);
-
- drawProgress(display, 66, "Updating forecasts...");
- HeFengClient.doUpdateFore(foreWeather, HEFENG_KEY, HEFENG_LOCATION);
-
- readyForWeatherUpdate = false;
- drawProgress(display, 100, "Done...");
- delay(200);
-
- }
- void drawDateTime(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) { //显示时间
- now = time(nullptr);
- struct tm* timeInfo;
- timeInfo = localtime(&now);
- char buff[16];
- display->setTextAlignment(TEXT_ALIGN_CENTER);
- display->setFont(ArialMT_Plain_16);
- String date = WDAY_NAMES[timeInfo->tm_wday];
- 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());
- display->drawString(64 + x, 5 + y, String(buff));
- display->setFont(ArialMT_Plain_24);
- sprintf_P(buff, PSTR("%02d:%02d:%02d"), timeInfo->tm_hour, timeInfo->tm_min, timeInfo->tm_sec);
- display->drawString(64 + x, 22 + y, String(buff));
- display->setTextAlignment(TEXT_ALIGN_LEFT);
- }
- void drawCurrentWeather(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) { //显示天气
- display->setFont(ArialMT_Plain_10);
- display->setTextAlignment(TEXT_ALIGN_CENTER);
- display->drawString(64 + x, 38 + y, currentWeather.cond_txt + " | Wind: " + currentWeather.wind_sc + " ");
- display->setFont(ArialMT_Plain_24);
- display->setTextAlignment(TEXT_ALIGN_LEFT);
- String temp = currentWeather.tmp + "°C" ;
- display->drawString(60 + x, 3 + y, temp);
- display->setFont(ArialMT_Plain_10);
- display->drawString(62 + x, 26 + y, currentWeather.fl + "°C | " + currentWeather.hum + "%");
- display->setFont(Meteocons_Plain_36);
- display->setTextAlignment(TEXT_ALIGN_CENTER);
- display->drawString(32 + x, 0 + y, currentWeather.iconMeteoCon);
- }
- void drawForecast(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) { //天气预报
- drawForecastDetails(display, x, y, 0);
- drawForecastDetails(display, x + 44, y, 1);
- drawForecastDetails(display, x + 88, y, 2);
- }
- void drawForecastDetails(OLEDDisplay *display, int x, int y, int dayIndex) { //天气预报
- display->setTextAlignment(TEXT_ALIGN_CENTER);
- display->setFont(ArialMT_Plain_10);
- display->drawString(x + 20, y, foreWeather[dayIndex].datestr);
- display->setFont(Meteocons_Plain_21);
- display->drawString(x + 20, y + 12, foreWeather[dayIndex].iconMeteoCon);
- String temp = foreWeather[dayIndex].tmp_min + " | " + foreWeather[dayIndex].tmp_max;
- display->setFont(ArialMT_Plain_10);
- display->drawString(x + 20, y + 34, temp);
- display->setTextAlignment(TEXT_ALIGN_LEFT);
- }
- void drawHeaderOverlay(OLEDDisplay *display, OLEDDisplayUiState* state) { //绘图页眉覆盖
- now = time(nullptr);
- struct tm* timeInfo;
- timeInfo = localtime(&now);
- char buff[14];
- sprintf_P(buff, PSTR("%02d:%02d"), timeInfo->tm_hour, timeInfo->tm_min);
- display->setColor(WHITE);
- display->setFont(ArialMT_Plain_10);
- display->setTextAlignment(TEXT_ALIGN_LEFT);
- display->drawString(6, 54, String(buff));
- display->setTextAlignment(TEXT_ALIGN_RIGHT);
- String temp = fans;
- display->drawString(122, 54, temp);
- display->drawHorizontalLine(0, 52, 128);
- }
- void setReadyForWeatherUpdate() { //为天气更新做好准备
- Serial.println("Setting readyForUpdate to true");
- readyForWeatherUpdate = true;
- }
复制代码
|