Выдает постоянно ошибку. другие кто пользовался кодом пишут что все нормально.
Arduino: 1.8.19 (Windows 7), Плата:"WeMos D1 R2 & mini, 80 MHz, 4M (1M SPIFFS), v2 Prebuilt (MSS=536), Disabled, None, 921600" Текст «как есть» (без применения форматирования)C:\Users\Максим\Documents\Arduino\sketch_dec06a\sketch_dec06a.ino: In function 'void getcrypto()':
sketch_dec06a:122:19: error: 'BearSSL' was not declared in this scope
sketch_dec06a:122:44: error: template argument 1 is invalid
sketch_dec06a:122:44: error: template argument 2 is invalid
sketch_dec06a:122:52: error: invalid type in declaration before '(' token
sketch_dec06a:122:57: error: expected type-specifier before 'BearSSL'
sketch_dec06a:123:9: error: base operand of '->' is not a pointer
sketch_dec06a:127:20: error: invalid type argument of unary '*' (have 'int')
sketch_dec06a:159:22: error: 'price_usd' was not declared in this scope
exit status 1
'BearSSL' was not declared in this scope
сам код
/*
DIY Bitcoin Tracker(BTC) on ESP8266
*/
#include "ArduinoJson.h"
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Max72xxPanel.h>
// ====== LED Matrix Settings ======
uint8_t pinCS = D8; // Specify which pin the CS pin is connected to
uint8_t numberOfHorizontalDisplays = 1; // Number of matrices horizontally
uint8_t numberOfVerticalDisplays = 4; // Number of matrices vertically
const char* ssid = "RT-2.4GHz_WIFI_4712"; // your network SSID (name)
const char* password = "UGydt7Qm"; // your network password
Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays);
String tape = "";
uint8_t wait = 100; // interval, the smaller number the faster the text runs
uint8_t spacer = 1; // Gap between characters (number of dots)
uint8_t width = 5 + spacer; // Font width is 5px
uint8_t mode = 3; // 1 - scroll, 2 - static value, 3 - scroll + static value
bool flag_cripto = false; // flag of successful receipt of BTC value
ESP8266WebServer HTTP(80);
void setup() {
Serial.begin(9600);
// ====== Setting up the matrix
matrix.setIntensity(0); // Set brightness from 0 to 15
matrix.setRotation(1); // Text direction 1,2,3,4
// ====== Introductory text ====
text_my("BTC-$");
// ==== Initialize WIFI ======
Serial.println();
Serial.println("Configuring access point...");
WiFi.begin(ssid, password);
Serial.println("Connecting...");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
// ===== get the value of BTC =====
getcrypto();
}
void loop() {
static uint32_t st_tmr2;
if (millis() - st_tmr2 > 90000) {
flag_cripto = false;
getcrypto();
st_tmr2 = millis();
}
if (flag_cripto) {
if (mode == 1 || mode == 3) {
String scrol_tape = "BTC " + (String)tape + " $";
scrol_text_my(scrol_tape);
}
if (mode == 2 || mode == 3) {
text_my(tape);
delay(10000);
}
}
}
// ======= Scroll text output ==========
void scrol_text_my(String tape_my) {
for (uint8_t i = 0; i < width * tape_my.length() + matrix.width() - spacer; i++) {
matrix.fillScreen(LOW);
uint8_t letter = i / width; // number of the symbol displayed on the matrix
int x = (matrix.width() - 1) - i % width;
int y = (matrix.height() - 8) / 2; // center text vertically
while (x + width - spacer >= 0 && letter >= 0) {
if (letter < tape_my.length()) {
matrix.drawChar(x, y, tape_my[letter], HIGH, LOW, 1);
}
letter--;
x -= width;
}
matrix.write(); // output the values to the matrix
delay(wait);
}
}
// =============== Text output ===============
void text_my(String tape_my) {
uint8_t x = (matrix.width() - (tape_my.length() * width)) / 2; //center alignment X
uint8_t y = (matrix.height() - 8) / 2; //center alignment Y
matrix.fillScreen(LOW);
for (uint8_t i = 0; i < tape_my.length(); i++) {
//uint8_t letter = i;
matrix.drawChar(x, y, tape_my[i], HIGH, LOW, 1);
x += width;
}
matrix.write(); // sending data to the display
}
void getcrypto() {
String payload = ""; // request json string
std::unique_ptr<BearSSL::WiFiClientSecure> client(new BearSSL::WiFiClientSecure);
client->setInsecure();
HTTPClient https;
String string_url;
string_url = "https://api.coinlore.net/api/ticker/?id=90";
if (https.begin(*client, string_url)) {
if (https.GET()) {
int httpCode = https.GET();
//Serial.println(httpCode);
if (httpCode > 0) {
if (httpCode == HTTP_CODE_OK) {
payload = https.getString();
payload.replace("[", "");
}
} else {
//Serial.printf("[HTTPS] GET... failed, error: %s\n\r", https.errorToString(httpCode).c_str());
}
https.end();
} else {
flag_cripto = true;
https.end();
}
} else {
//Serial.printf("[HTTPS] Unable to connect\n\r");
flag_cripto = true;
}
if (!flag_cripto) {
StaticJsonDocument<700> parsed; //Memory pool
// Deserialize the JSON document
DeserializationError error = deserializeJson(parsed, payload);
// Check if parsing succeeds.
if (error) {
Serial.print(F("deserializeJson() failed: "));
Serial.println(error.f_str());
return;
} else { //Output if there are no errors
//int price_usd = parsed["price_usd"].as<int>(); //Get value
tape = (String)price_usd;
flag_cripto = true;
Serial.println(tape);
}
}
}
это "WeMos D1 mini clon".
на другом компьютере не компилируется
ошибка
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00000d64 (most recent call first):
exit status 3
C:\Program Files (x86)\Arduino\arduino-builder returned 3
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.
скетч
/*
DIY Bitcoin Tracker(BTC) on ESP8266
*/
#include "ArduinoJson.h"
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>
#include <SPI.h>
//#include <Adafruit_GFX.h>
//#include <Max72xxPanel.h>
// ====== LED Matrix Settings ======
uint8_t pinCS = D8; // Specify which pin the CS pin is connected to
uint8_t numberOfHorizontalDisplays = 1; // Number of matrices horizontally
uint8_t numberOfVerticalDisplays = 4; // Number of matrices vertically
const char* ssid = "RT-2.4GHz_WIFI_4712"; // your network SSID (name)
const char* password = "UGydt7Qm"; // your network password
//Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays);
String tape = "";
uint8_t wait = 100; // interval, the smaller number the faster the text runs
uint8_t spacer = 1; // Gap between characters (number of dots)
uint8_t width = 5 + spacer; // Font width is 5px
uint8_t mode = 3; // 1 - scroll, 2 - static value, 3 - scroll + static value
bool flag_cripto = false; // flag of successful receipt of BTC value
ESP8266WebServer HTTP(80);
void setup() {
Serial.begin(9600);
// ====== Setting up the matrix
// matrix.setIntensity(0); // Set brightness from 0 to 15
// matrix.setRotation(1); // Text direction 1,2,3,4
// ====== Introductory text ====
text_my("BTC-$");
// ==== Initialize WIFI ======
Serial.println();
Serial.println("Configuring access point...");
WiFi.begin(ssid, password);
Serial.println("Connecting...");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
// ===== get the value of BTC =====
getcrypto();
}
void loop() {
static uint32_t st_tmr2;
if (millis() - st_tmr2 > 90000) {
flag_cripto = false;
getcrypto();
st_tmr2 = millis();
}
if (flag_cripto) {
if (mode == 1 || mode == 3) {
String scrol_tape = "BTC " + (String)tape + " $";
//scrol_text_my(scrol_tape);
}
if (mode == 2 || mode == 3) {
//text_my(tape);
delay(10000);
}
}
}
// ======= Scroll text output ==========
void scrol_text_my(String tape_my) {
/*for (uint8_t i = 0; i < width * tape_my.length() + matrix.width() - spacer; i++) {
matrix.fillScreen(LOW);
uint8_t letter = i / width; // number of the symbol displayed on the matrix
int x = (matrix.width() - 1) - i % width;
int y = (matrix.height() - 8) / 2; // center text vertically
while (x + width - spacer >= 0 && letter >= 0) {
if (letter < tape_my.length()) {
matrix.drawChar(x, y, tape_my[letter], HIGH, LOW, 1);
}
letter--;
x -= width;
}
matrix.write(); // output the values to the matrix
delay(wait);
}*/
}
// =============== Text output ===============
void text_my(String tape_my) {
/*uint8_t x = (matrix.width() - (tape_my.length() * width)) / 2; //center alignment X
uint8_t y = (matrix.height() - 8) / 2; //center alignment Y
matrix.fillScreen(LOW);
for (uint8_t i = 0; i < tape_my.length(); i++) {
//uint8_t letter = i;
matrix.drawChar(x, y, tape_my[i], HIGH, LOW, 1);
x += width;
}
matrix.write(); */ // sending data to the display
}
void getcrypto() {
String payload = ""; // request json string
std::unique_ptr<BearSSL::WiFiClientSecure> client(new BearSSL::WiFiClientSecure);
client->setInsecure();
HTTPClient https;
String string_url;
string_url = "https://api.coinlore.net/api/ticker/?id=90";
if (https.begin(*client, string_url)) {
if (https.GET()) {
int httpCode = https.GET();
//Serial.println(httpCode);
if (httpCode > 0) {
if (httpCode == HTTP_CODE_OK) {
payload = https.getString();
payload.replace("[", "");
}
} else {
//Serial.printf("[HTTPS] GET... failed, error: %s\n\r", https.errorToString(httpCode).c_str());
}
https.end();
} else {
flag_cripto = true;
https.end();
}
} else {
//Serial.printf("[HTTPS] Unable to connect\n\r");
flag_cripto = true;
}
if (!flag_cripto) {
StaticJsonDocument<700> parsed; //Memory pool
// Deserialize the JSON document
DeserializationError error = deserializeJson(parsed, payload);
// Check if parsing succeeds.
if (error) {
Serial.print(F("deserializeJson() failed: "));
Serial.println(error.f_str());
return;
} else { //Output if there are no errors
int price_usd = parsed["price_usd"].as<int>(); //Get value
tape = (String)price_usd;
flag_cripto = true;
Serial.println(tape);
}
}
}
снова таже ошибка
C:\Users\Максим\Documents\Arduino\sketch_dec09b\sketch_dec09b.ino: In function 'void getcrypto()':
sketch_dec09b:122:19: error: 'BearSSL' was not declared in this scope
sketch_dec09b:122:44: error: template argument 1 is invalid
sketch_dec09b:122:44: error: template argument 2 is invalid
sketch_dec09b:122:52: error: invalid type in declaration before '(' token
sketch_dec09b:122:57: error: expected type-specifier before 'BearSSL'
sketch_dec09b:123:9: error: base operand of '->' is not a pointer
sketch_dec09b:127:20: error: invalid type argument of unary '*' (have 'int')
exit status 1
'BearSSL' was not declared in this scope