How to display on blynk chart

how can i display the data using graph widget on blynk??? help me please, im beginner… im appreciate ur help…tq all

below are my ino.

#define BLYNK_PRINT Serial
#include <Filters.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

const int LED =25;
const int Relay =33;

float testFrequency = 60;                     // test signal frequency (Hz)
float windowLength = 20.0/testFrequency;     // how long to average the signal, for statistist
 int sensorValue = 0;
float intercept = -0.1129; // to be adjusted based on calibration testing
float slope = 0.0065; // to be adjusted based on calibration testing
float current_amps; // estimated actual current in amps

unsigned long printPeriod = 1000; // in milliseconds
// Track time in milliseconds since last reading 
 unsigned long previousMicros = 0;

void setup() {
 Serial.begin( 57600 );    // start the serial port
pinMode(Relay, OUTPUT);
pinMode(LED,OUTPUT);


}

void loop() {
 RunningStatistics inputStats;                 // create statistics to look at the raw test signal
 inputStats.setWindowSecs( windowLength );

 while( true ) {   
  sensorValue = analogRead(A0);  // read the analog in value:
 inputStats.input(sensorValue);  // log to Stats function
    
    if((unsigned long)(millis() - previousMicros) >= printPeriod) {
  previousMicros = millis();   // update time
  
  // display current values to the screen
  Serial.print( "\n" );
  // output sigma or variation values associated with the inputValue itsel
  Serial.print( "\tsigma: " ); 
  Serial.print( inputStats.sigma() );
  // convert signal sigma value to current in amps
  current_amps = intercept + slope * inputStats.sigma();
  Serial.print( "\tamps: " ); 
  Serial.print( current_amps );

  if (current_amps >= 20)
  {
    digitalWrite(LED, LOW);
    digitalWrite(Relay, HIGH);
    Serial.print("fault occur");
delay(500);
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
}
else
{
 digitalWrite(Relay, LOW);
 delay(100);
     }
    }
   }
}

i wanted to display the current value on chart terminal…and then when the current exceed 20A, the notification will be display on my LCD that showing “fault occurs”… tq sir…

im trying sir…but i still fail…can u show me what should i added on my ino.???

your void loop() will never work with Blynk

You need to time events with timer:
https://examples.blynk.cc/?board=ESP32&shield=ESP32%20WiFi&example=GettingStarted%2FPushData

I really suggest you read the article first

my void loop will never work with blynk??? so what should i do sir??? i just want to display on blynk… can u suggest me another ways sir??? its my final year project…

Are you serious?

Ok, I will paste the article here, so that you don’t need to click

Avoiding the void

:point_up: :fire: :warning: VERY IMPORTANT: You can’t send sensor data in your void loop()

– Why?
– Because Blynk sends data over the Internet, and when you put something into void loop(), your microcontroller will execute it :scream_cat: gazillion number of times. Which means that Blynk Cloud will be flooded with gazillion messages from your hardware.

And when Blynk Cloud notices that, it automatically :scissors:︎ cuts your connection. Sorry…

– OK, what should I do then?
– Send sensor data in intervals!

Using timers to send sensor data in intervals
There are lots of ways to send data in intervals, but here is a simple one. We recommend using a BlynkTimer for that. It’s included in Blynk Library Package, so if you installed Library correctly, you are all set.

Open Blynk app:

  • Create a New Project (new Auth Token will be sent to your email)
  • Add Value Display Widget
  • Go to Widget Settings
  • Set PIN to V5
  • Set Frequency to PUSH
    It means that Blynk app will be waiting for the data whenever your hardware sends it.

Preparing the code:

Open this example sketch. Just change it to your hardware and connection;

  • Check your email inbox for Auth Token;
  • Insert your Auth Token in the sketch;
  • :zap: Flash the code to your hardware;
  • In the Blynk app - press Play button;
  • You should see the data coming;
    Let’s look at the code so you better understand it for your next projects.

We create a BlynkTimer object, called… timer:

BlynkTimer timer; // Announcing the timer
Then we are creating a function that should be performed in intervals. We will read the sensor connected to A0, and then send it to Virtual Pin V5:

void myTimerEvent()
{
  sensorData = analogRead(A0);
  Blynk.virtualWrite(V5, sensorData);
}

In setup, we declare that our function myTimerEvent() should run every 1000 milliseconds, which is 1 second.

void setup()
{
  ...
  ...
  ...
  timer.setInterval(1000L, myTimerEvent);
}

And now look at our beautiful void loop()

void loop()
{
  Blynk.run();
  timer.run(); // running timer every second
}

sory sir…i do read that already…but i still dont get what should i do… sory for buden u sir…i dont mean that… i just beginner…im sory sir…

If you did that, please show your code.

i dont know how to recall the data on my void loop?? still working on that coding…sory sir…

I guess the quality of school just isn’t what it used to be :stuck_out_tongue: I remember being taught to do my own research… here it comes… :stuck_out_tongue_winking_eye:

Blynk - RE-SEAR-CH

Perhaps you can start with some basic examples and work your way up through them until you have a better understanding of how Blynk, and code, works?

sir, thank for ur guidance… my problem solve… im sorry for burden u… but thanks, i learn a lot and know, i get what u re saying to me…PROBLEM SOLVE