Help with Blynk code

Hi, I’m a beginner at Blynk, and I’m doing a project for a university course.
I need to have the NodeMCU esp8266 read the analog values (A0) for one minute and calculate the average of the read values and send the mean value to the Blynk application on the smatphone. I made an initial code, however I have encountered problems in the script performing the functions I need.
Also, I wonder if there is a way to attach a micro SD card shield to save the average values.
I thank the help of all.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

char auth[] = “token”;
char ssid[] = “apto - 304”;
char pass[] = “244466666”;

BlynkTimer sensor; // Criação do Timer do sensor

String stringOne;
String Stringday;
unsigned long atual;
unsigned long anterior = 0;
const long intervalo = 60000;
unsigned long val = 0.00;
unsigned long s;
float media;
int dia = 0.00;
int minutos = 0;

void lerSensor() // Função para ler os parâmetros do DHT22
atual = millis();
if (anterior != atual)
int valor = analogRead (A0);
val = val + valor;
s = s + 1.00;
if (atual - anterior >= intervalo )
anterior = atual;
media = (val * 3.2226) / s;
if (minutos == 1439.00)
dia = dia + 1;
Stringday = dia;
minutos = 0.00;
s = 0.00;
val = 0.00;
Blynk.virtualWrite(V2, media); // Escreve no pino virtual V5 do Blynk o valor de umidade lido pelo DHT22

void setup()
Blynk.begin(auth, ssid, pass);
sensor.setInterval(60000L, lerSensor); // Define o intervalo de tempo da leitura para 60000 milisegundos

void loop()
{;; // Inicializa o Timer

does this help?

If you got this working, all that would be left is the math.

I am already following and has worked, I can calculate the average of the data read for a minute and I can send them, there is missing the SD card.
Thank you for your help.

You could add an SD card, but that’s not a Blynk related thing and this isn’t daddy the best place to find out how to do that.

However, you don’t really need an SD card if you use the Blynk functionality properly. If you wrote your average data to a virtual pin every minute (for example) then you could use the Superchart widget to visualise the data and the report widget to pull out the data in a CSV format if needed.