Как устранить проблему. файл есть в папке

Before creating the topic

  1. Search forum for similar topics
  2. Check http://docs.blynk.cc and http://help.blynk.cc/
  3. Add details :
    • Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
    • Smartphone OS (iOS or Android) + version
    • Blynk server or local server
    • Blynk Library version
    • Add your sketch code. :point_up:Code should be formatted as example below.

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.


void loop()
In file included from c:\Users\mainp\OneDrive\���������\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:41:
c:\Users\mainp\OneDrive\���������\Arduino\libraries\SoftwareSerial/avr/interrupt.h:38:10: fatal error: avr/io.h: No such file or directory
   38 | #include <avr/io.h>
      |          ^~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

We need to see your sketch.

Pete.

Please delete the screenshots and post the text, with triple backticks at the beginning and end so that it displays correctly.
Triple backticks look like this:
```

Pete.

я не знаю как сделать тройные кавычки в Arduino IDE

#include <I2S.h>

/* Sketch by RBMK-5000
This sketch is ready to use, simply fill your WiFi SSID, Password & Blynk Token on line 21-23 below.
Use NodeMCU ESP8266 or Wemos D1 mini + Oled I2C 128x64 SSD1306.
I also provide Detailed Schematic and Blynk Project QR Code, refer elsewhere.
*/
#define BLYNK_TEMPLATE_ID "PZEM-004T"
#define BLYNK_DEVICE_NAME "ESP 8266"
#define BLYNK_AUTH_TOKEN "b2wkJjplqB8dPLsdt8ONJdYw1JuF3yta"

#include <PZEM004Tv30.h>
#include <BlynkSimpleEsp8266.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>


#define DISPLAY_ADDRESS   0x3C // or 0x3D
#define DISPLAY_SCL_PIN   5
#define DISPLAY_SDA_PIN   4
#define DISPLAY_WIDTH     128 // OLED display width, in pixels
#define DISPLAY_HEIGHT    64  // OLED display height, in pixels
#define DISPLAY_RESET_PIN -1  // Reset pin # (or -1 if sharing with ESP8266 reset pin)

Adafruit_SSD1306 display(DISPLAY_WIDTH, DISPLAY_HEIGHT, &Wire, DISPLAY_RESET_PIN);

PZEM004Tv30 pzem1(14, 12); // GPIO14(D5) to Tx PZEM004; GPIO12(D6) to Rx PZEM004

char ssid[] = "TP-Link_2DD4"; // WiFi Name
char pass[] = "050170"; // WiFi Password
char auth[] = "b2wkJjplqB8dPLsdt8ONJdYw1JuF3yta"; //Blynk Token

float voltage1, current1, power1, energy1, frequency1, pf1, va1, VAR1;

void setup() {
  Serial.begin(115200);
  setupDisplay();
  Blynk.begin(auth, ssid, pass, "iot.serangkota.go.id", 8080); // Change the Blynk Server and Port Number when required.
}

void setupDisplay() {
  Wire.begin(DISPLAY_SDA_PIN, DISPLAY_SCL_PIN);           // You can also set I2C SCL&SDA pins to other GPIOs
  display.begin(SSD1306_SWITCHCAPVCC, DISPLAY_ADDRESS);

  display.clearDisplay();
  display.setCursor(10, 0);
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.println("PZEM-004T");
  display.setCursor(10, 36);
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.println("Connecting Blynk..");
  display.display();
  delay(1000);
}

void loop() {
  voltage1 = pzem1.voltage();
  voltage1 = zeroIfNan(voltage1);
  current1 = pzem1.current();
  current1 = zeroIfNan(current1);
  power1 = pzem1.power();
  power1 = zeroIfNan(power1);
  energy1 = pzem1.energy() / 1000; //kwh
  energy1 = zeroIfNan(energy1);
  frequency1 = pzem1.frequency();
  frequency1 = zeroIfNan(frequency1);
  pf1 = pzem1.pf();
  pf1 = zeroIfNan(pf1);
  if (pf1 == 0) {
    va1 = 0;
  } else {
    va1 = power1 / pf1;
  }
  if (pf1 == 0) {
    VAR1 = 0;
  } else {
    VAR1 = power1 / pf1 * sqrt(1-sq(pf1));
  }
  delay(1000);

  Blynk.run();
  // Send to Blynk
  Blynk.virtualWrite(V1, voltage1);
  Blynk.virtualWrite(V2, current1);
  Blynk.virtualWrite(V3, power1);
  Blynk.virtualWrite(V4, energy1);
  Blynk.virtualWrite(V5, frequency1);
  Blynk.virtualWrite(V6, pf1);
  Blynk.virtualWrite(V7, va1);
  Blynk.virtualWrite(V8, VAR1);
  Blynk.virtualWrite(V9, (power1 / va1) * 100);

  Serial.println("");
  Serial.printf("Voltage        : %.2f\ V\n", voltage1);
  Serial.printf("Current        : %.2f\ A\n", current1);
  Serial.printf("Power Active   : %.2f\ W\n", power1);
  Serial.printf("Frequency      : %.2f\ Hz\n", frequency1);
  Serial.printf("Cosine Phi     : %.2f\ PF\n", pf1);
  Serial.printf("Energy         : %.2f\ kWh\n", energy1);
  Serial.printf("Apparent Power : %.2f\ VA\n", va1);
  Serial.printf("Reactive Power : %.2f\ VAR\n", VAR1);
  Serial.printf("---------- END ----------");
  Serial.println("");

  display.clearDisplay();
  display.setCursor(0, 0);
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.printf("Voltage  : %.2f\ V\n", voltage1);
  display.printf("Current  : %.2f\ A\n", current1);
  display.printf("Power RMS: %.2f\ W\n", power1);
  display.printf("Cos Phi  : %.2f\ PF\n", pf1);
  display.printf("Apprn Pwr: %.1f\ VA\n", va1);
  display.printf("React Pwr: %.1f\ VAR\n", VAR1);
  display.printf("Frequency: %.1f\ Hz\n", frequency1);
  display.printf("Energy   : %.1f\ kWh\n", energy1);
  display.display();
  delay(2000);
}

void printValue(String label, float value) {
  if (value != NAN) {
    Serial.print(label); Serial.println(value);
  } else {
    Serial.println("Error reading");
  }
}

float zeroIfNan(float v) {
  if (isnan(v)) {
    v = 0;
  }
  return v;
}

You don’t put them in the IDE, you put them in your post here when you paste your code.
I’ve given you example triple backticks to copy/paste if you can’t find the correct symbol on your keyboard.

Pete.

In file included from c:\Users\mainp\OneDrive\���������\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:41:
c:\Users\mainp\OneDrive\���������\Arduino\libraries\SoftwareSerial/avr/interrupt.h:38:10: fatal error: avr/io.h: No such file or directory
   38 | #include <avr/io.h>
      |          ^~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

You’re not using an official Blynk server, so I’m not going to comment on your post any further.

@Pavel are you aware of this server?

Pete.

я прошу прощения. какой офицыальный сервер и как подключится к нему?

Create a Blynk account here…

Pete.

так правильно? я не разобрался как будет показывать информацыю в телефоне

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define DISPLAY_ADDRESS   0x3C // or 0x3D
#define DISPLAY_SCL_PIN   5
#define DISPLAY_SDA_PIN   4
#define DISPLAY_WIDTH     128 // OLED display width, in pixels
#define DISPLAY_HEIGHT    64  // OLED display height, in pixels
#define DISPLAY_RESET_PIN -1  // Reset pin # (or -1 if sharing with ESP8266 reset pin)
#define BLYNK_TEMPLATE_ID "TMPL57TMpweiw"
#define BLYNK_TEMPLATE_NAME "pzem"
Adafruit_SSD1306 display(DISPLAY_WIDTH, DISPLAY_HEIGHT, &Wire, DISPLAY_RESET_PIN);

PZEM004Tv30 pzem1(14, 12); // GPIO14(D5) to Tx PZEM004; GPIO12(D6) to Rx PZEM004

char ssid[] = "TP-Link_2DD4"; // WiFi Name
char pass[] = "05011970"; // WiFi Password
char auth[] = "TsD4AAl6512b4e44WwqWI6VTWfPXzrdy"; //Blynk Token

float voltage1, current1, power1, energy1, frequency1, pf1, va1, VAR1;

void setup() {
  Serial.begin(115200);
  setupDisplay();
  //Blynk.begin(auth, ssid, pass, "iot.serangkota.go.id", 8080); // Change the Blynk Server and Port Number when required.
}

void setupDisplay() {
  Wire.begin(DISPLAY_SDA_PIN, DISPLAY_SCL_PIN);           // You can also set I2C SCL&SDA pins to other GPIOs
  display.begin(SSD1306_SWITCHCAPVCC, DISPLAY_ADDRESS);

  display.clearDisplay();
  display.setCursor(10, 0);
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.println("PZEM-004T");
  display.setCursor(10, 36);
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.println("Connecting Blynk..");
  display.display();
  delay(1000);
}

void loop() {
  voltage1 = pzem1.voltage();
  voltage1 = zeroIfNan(voltage1);
  current1 = pzem1.current();
  current1 = zeroIfNan(current1);
  power1 = pzem1.power();
  power1 = zeroIfNan(power1);
  energy1 = pzem1.energy() / 1000; //kwh
  energy1 = zeroIfNan(energy1);
  frequency1 = pzem1.frequency();
  frequency1 = zeroIfNan(frequency1);
  pf1 = pzem1.pf();
  pf1 = zeroIfNan(pf1);
  if (pf1 == 0) {
    va1 = 0;
  } else {
    va1 = power1 / pf1;
  }
  if (pf1 == 0) {
    VAR1 = 0;
  } else {
    VAR1 = power1 / pf1 * sqrt(1-sq(pf1));
  }
  delay(1000);

  Blynk.run();
  // Send to Blynk
  Blynk.virtualWrite(V1, voltage1);
  Blynk.virtualWrite(V2, current1);
  Blynk.virtualWrite(V3, power1);
  Blynk.virtualWrite(V4, energy1);
  Blynk.virtualWrite(V5, frequency1);
  Blynk.virtualWrite(V6, pf1);
  Blynk.virtualWrite(V7, va1);
  Blynk.virtualWrite(V8, VAR1);
  Blynk.virtualWrite(V9, (power1 / va1) * 100);

  Serial.println("");
  Serial.printf("Voltage        : %.2f\ V\n", voltage1);
  Serial.printf("Current        : %.2f\ A\n", current1);
  Serial.printf("Power Active   : %.2f\ W\n", power1);
  Serial.printf("Frequency      : %.2f\ Hz\n", frequency1);
  Serial.printf("Cosine Phi     : %.2f\ PF\n", pf1);
  Serial.printf("Energy         : %.2f\ kWh\n", energy1);
  Serial.printf("Apparent Power : %.2f\ VA\n", va1);
  Serial.printf("Reactive Power : %.2f\ VAR\n", VAR1);
  Serial.printf("---------- END ----------");
  Serial.println("");

  display.clearDisplay();
  display.setCursor(0, 0);
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.printf("Voltage  : %.2f\ V\n", voltage1);
  display.printf("Current  : %.2f\ A\n", current1);
  display.printf("Power RMS: %.2f\ W\n", power1);
  display.printf("Cos Phi  : %.2f\ PF\n", pf1);
  display.printf("Apprn Pwr: %.1f\ VA\n", va1);
  display.printf("React Pwr: %.1f\ VAR\n", VAR1);
  display.printf("Frequency: %.1f\ Hz\n", frequency1);
  display.printf("Energy   : %.1f\ kWh\n", energy1);
  display.display();
  delay(2000);
}

void printValue(String label, float value) {
  if (value != NAN) {
    Serial.print(label); Serial.println(value);
  } else {
    Serial.println("Error reading");
  }
}

float zeroIfNan(float v) {
  if (isnan(v)) {
    v = 0;
  }
  return v;
}
In file included from c:\Users\mainp\OneDrive\���������\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:41:
c:\Users\mainp\OneDrive\���������\Arduino\libraries\SoftwareSerial/avr/interrupt.h:38:10: fatal error: avr/io.h: No such file or directory
   38 | #include <avr/io.h>
      |          ^~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

If you want support from me I need to understand what you’ve done in terms of signing-up for a Blynk account, creating a template and device, setting-up a dashboard etc.

I also need to know what hardware you are using, what version of the ESP8266 core you have installed, what version of the Blynk library you have installed, and what board type you are using in the IDE.

Pete.

NodeMCU 1.0 (ESP-12E Module)

Arduino IDE
Version: 2.3.1
Date: 2024-02-15T09:01:25.701Z
CLI Version: 0.35.2
Copyright © 2024 Arduino SA

Blynk Volodymyr Shimanskyy
v1.3.2

зарегистрировался. шаблон устройство не делал я читаю инструкцию как настроить блинк.

You didn’t answer these questions.

Pete.

Type NodeMCU 1.0 (ESP-12E Module. arduino ide. Версия ядра не понимаю.

It is a fake legacy cloud server :rofl:

:thinking:Interesting!

1 Like