Я сейчас пытаюсь запрограммировать свой M5Stack с чипом ESP32. Я скачал (или хотя бы подумал) все зависимости, необходимые для загрузки на доску, но я даже не могу заставить свою программу скомпилироваться. Я скачал ESP32 через менеджер плат, следовал учебному пособию по M5Stack на их веб-сайте и, похоже, обнаружил ошибки в самой библиотеке. Я не уверен, как исправить, ниже мой код, а ниже - сообщения об ошибках, которые я получаю.
#include <M5Stack.h>
#include <Wire.h>
#define SPEAKER_PIN 25
#include "config.h"
AdafruitIO_Feed *voltage1 = io.feed("V1");
AdafruitIO_Feed *voltage2 = io.feed("V2");
AdafruitIO_Feed *curr = io.feed("Current");
void setup() {
// put your setup code here, to run once:
M5.begin(true, true, true, false);
Serial.begin(115200);
dacWrite(25,0);
M5.Lcd.fillScreen(BLACK);
M5.Lcd.setTextSize(5);
// wait for serial monitor to open
while(! Serial);
Serial.print("Connecting to Adafruit IO");
// connect to io.adafruit.com
io.connect();
// wait for a connection
while(io.status() < AIO_CONNECTED) {
Serial.print(".");
delay(500);
}
// we are connected
Serial.println();
Serial.println(io.statusText());
// ads.getAddr_ADS1100(ADS1100_DEFAULT_ADDRESS);
// ads.setGain(GAIN_ONE);
// ads.setMode(MODE_CONTIN);
// ads.setRate(RATE_32);
// ads.setOSMode(OSMODE_SINGLE);
// ads.begin();
}
void loop() {
io.run();
// put your main code here, to run repeatedly:
float v1 = (float)analogRead(36) / 4096 * 17.4 * 0.975;
float v2 = (float)analogRead(35) / 4096 * 17.4 * 0.975;
float current = (float)analogRead(5);
Serial.print("v1: ");
Serial.print(v1);
Serial.println("V");
Serial.print("v2: ");
Serial.print(v2);
Serial.println("V");
M5.Lcd.setTextColor(WHITE);
M5.Lcd.setCursor(10, 10);
M5.Lcd.print("V1: ");
M5.Lcd.print(v1);
M5.Lcd.print("V");
M5.Lcd.setTextColor(WHITE);
M5.Lcd.setCursor(10, 70);
M5.Lcd.print("V2: ");
M5.Lcd.print(v2);
M5.Lcd.print("V");
M5.Lcd.setTextColor(WHITE);
M5.Lcd.setCursor(10, 140);
M5.Lcd.print("Current: ");
M5.Lcd.print(current);
M5.Lcd.print("A");
delay(500);
M5.Lcd.setCursor(10, 10);
M5.Lcd.setTextColor(BLACK);
M5.Lcd.print("V1: ");
M5.Lcd.print(v1);
M5.Lcd.print("V");
M5.Lcd.setCursor(10, 70);
M5.Lcd.setTextColor(BLACK);
M5.Lcd.print("V2: ");
M5.Lcd.print(v2);
M5.Lcd.print("V");
M5.Lcd.setTextColor(BLACK);
M5.Lcd.setCursor(10, 140);
M5.Lcd.print("Current: ");
M5.Lcd.print(current);
M5.Lcd.print("A");
Serial.print("sending v1-> ");
Serial.println(v1);
voltage1->save(v1);
Serial.print("sending v2-> ");
Serial.println(v2);
voltage2->save(v2);
Serial.print("sending Current-> ");
Serial.println(current);
curr->save(current);
}
Вывод ошибки:
Arduino: 1.8.12 (Windows 10), Board: "M5Stack-Core-ESP32, QIO, 80MHz, Default, 921600, None"
C:\Users\graff\OneDrive\Documents\Arduino\libraries\M5Stack\src\M5Display.cpp: In member function 'void M5Display::drawPngUrl(const char*, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, double, uint8_t)':
C:\Users\graff\OneDrive\Documents\Arduino\libraries\M5Stack\src\M5Display.cpp:543:3: error: 'HTTPClient' was not declared in this scope
HTTPClient http;
^
C:\Users\graff\OneDrive\Documents\Arduino\libraries\M5Stack\src\M5Display.cpp:545:7: error: 'WiFi' was not declared in this scope
if (WiFi.status() != WL_CONNECTED) {
^
C:\Users\graff\OneDrive\Documents\Arduino\libraries\M5Stack\src\M5Display.cpp:545:24: error: 'WL_CONNECTED' was not declared in this scope
if (WiFi.status() != WL_CONNECTED) {
^
C:\Users\graff\OneDrive\Documents\Arduino\libraries\M5Stack\src\M5Display.cpp:550:3: error: 'http' was not declared in this scope
http.begin(url);
^
C:\Users\graff\OneDrive\Documents\Arduino\libraries\M5Stack\src\M5Display.cpp:553:19: error: 'HTTP_CODE_OK' was not declared in this scope
if (httpCode != HTTP_CODE_OK) {
^
C:\Users\graff\OneDrive\Documents\Arduino\libraries\M5Stack\src\M5Display.cpp:559:3: error: 'WiFiClient' was not declared in this scope
WiFiClient *stream = http.getStreamPtr();
^
C:\Users\graff\OneDrive\Documents\Arduino\libraries\M5Stack\src\M5Display.cpp:559:15: error: 'stream' was not declared in this scope
WiFiClient *stream = http.getStreamPtr();
^
Multiple libraries were found for "WiFi.h"
Used: C:\Users\graff\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Not used: C:\Users\graff\OneDrive\Documents\Arduino\libraries\WiFi
Multiple libraries were found for "SD.h"
Used: C:\Users\graff\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\SD
Not used: C:\Program Files (x86)\Arduino\libraries\SD
Not used: C:\Users\graff\OneDrive\Documents\Arduino\libraries\SD
exit status 1
Error compiling for board M5Stack-Core-ESP32.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.