blynk code using ARDUINO

I know this is not a blynk forum , but I urgently need some help on coding part . I’m very weak in this area !
however I tried to code after making some research for my project.


project concept : comparator sends DIGITAL HIGH to PIN 12 on a fault scenario , and ARDUINO activates a 5v relay connected to PIN 13 .
Along with this , current will be measured using Acs712 sensor .

I actually developed a conventional code for relay activation based on comparator HIGH and current calculation using sensor without using blynk syntax . where i placed all my code within the Void loop () and did the purpose in simulation . Later I realised this code could be modified in such a way, the necessary data could be send to blynk APP using virtual pins .

here’s my code look like !

//Measuring Current Using ACS712
const int analogchannel = 0; 
int sensitivity = 66;
float adcvalue= 0;
int offsetvoltage = 2500; 
double Voltage = 0; 
double ecurrent = 0; //all these for current calc
const int relay = 13;//fault check 
const int pin = 12; //input digital 

#define BLYNK_PRINT Serial

#include <SoftwareSerial.h>
SoftwareSerial SwSerial(0, 1); // RX, TX
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>

char auth[] = "**************";
SoftwareSerial SerialBLE(0, 1); // RX, TX

BlynkTimer timer;

void myTimerEvent()

 unsigned int temp=0;
 float maxpoint = 0;
 int i=0;


 if(temp = analogRead(analogchannel),temp>maxpoint)
 maxpoint = temp;

 adcvalue = maxpoint; 
 Voltage = (adcvalue / 1024.0) * 5000; // Gets you mV
 ecurrent = ((Voltage - offsetvoltage) / sensitivity);
 ecurrent = ( ecurrent ) / ( sqrt(2) );
 Serial.print("\t ecurrent = "); 
 Serial.println(ecurrent,3);  // this is the current we need 

        serial.Println("R phase fault); 
        Blynk.virtualWrite(V0, "R phase fault"); //fault display 
 Blynk.virtualWrite(V1, ecurrent);


void setup()


  Blynk.begin(SerialBLE, auth);

  Serial.println("Waiting for connections...");

    timer.setInterval(1600L, myTimerEvent);

void loop()
{;;  // Initiates BlynkTimer

does this look logical based on my purpose ??

SoftwareSerial SerialBLE(0, 1); // RX, TX

You can NOT do software serial on the hardware serial pins.

does that mean I've to pick some pins DIGITAL pins like 3 or 4 for my purpose ??

Have you tried the HC05 / HC06 example that comes with the Blynk library?

does that mean I've to pick some pins DIGITAL pins like 3 or 4 for my purpose ??

Or any unused analog pins. You just can not use pins that are already in use.