I am attempting to send data in the superchart in an email. However, when I select “export to CSV”, I haven’t received an email. There is data in the chart. What am I doing incorrectly here?
I don’t know if it is necessary, but attached is my code:
#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(0, 1); // RX, TX
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
char auth[] = "Auth Token : e2bc64ad889b46b091f58415da3b050b";
SoftwareSerial SerialBLE(10, 11); // RX, TX #include <Servo.h> //includes servo
#include <stdlib.h> //includes standard library
Servo myservo; // create servo object to control a servo
int sensorOne=2; //digital pin 2 has connected to the resistor of first sensor
int inputOne=0; //variable to store the values from the analog pin 0
int servoAngle=0; // variable to store the servo position, initial angle set to zero
BLYNK_WRITE(V1) //when V1 button is pressed
{ switch (param.asInt())
{
case 2: // if cloudy
int sensorvalue= analogRead(A0); //reads value
Blynk.virtualWrite(V3, sensorvalue); //sends value to virtual pin V3
break;
case 1: // if sunny
sensorvalue= analogRead(A0); //reads value
Blynk.virtualWrite(V2, sensorvalue); //sends value to virtual pin V2
break;
}
}
BlynkTimer timer; // announces the timer
void setup()
{
Serial.begin(9600); //sets baud rate to 9600
SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
pinMode(sensorOne,OUTPUT); //initialize the digital pin as output
digitalWrite(sensorOne,HIGH); //voltage set to corresponding value of 5V
myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo.write(servoAngle); // tell servo to go to position in variable 'servoAngle'
timer.setInterval(1000L, sensorDataSend); //timer will run every 15 min
}
void sensorDataSend() {
int sensorValue = analogRead(A0); // reading sensor from analog pin
Blynk.virtualWrite(V2, sensorValue); //send data to Blynk App
delay(600000); //delays for 15 minutes
}
void loop()
{
Blynk.run(); //runs Blynk
timer.run(); //run timer every 15 min
float flux[179];
for (servoAngle=0; servoAngle<180; servoAngle++)
{
flux[servoAngle]= analogRead(inputOne); //creates an array of values read from the LDR
myservo.write(servoAngle); //moves servo from 0 to 180 degrees
Serial.println(flux[servoAngle]); //writes values in flux array to graph
Serial.println("");
}
int servoAngle2 = findMax(flux); //tells it to find max loctaion, see max function below
myservo.write(servoAngle2); // tells servo to go to angle at which voltage is max
//delay(100000); //delays for 15 min before checking again
}
int findMax(float* flux){ //function to find the location at which the voltage is maxiumum
int maximum = 0;
for (int c = 0; c < 180; c++)
{
if (flux[c] > flux[maximum])
{
maximum = c;
}
}
return maximum;
}