BLYNK coding problem

is it possible to combine the code with blynk server?
i just want to display my counter values…

#define S0 2
#define S1 3
#define S2 4
#define S3 5
#define sensorOut 6
Servo topServo;
Servo bottomServo;
int frequency = 0;
int color=0;
int c_red=0;
int c_blue=0;
int c_green=0;
int c_brown=0;
int c_yellow=0;
int c_orange=0;

void setup() {
  pinMode(13, INPUT);
  pinMode(S0, OUTPUT);
  pinMode(S1, OUTPUT);
  pinMode(S2, OUTPUT);
  pinMode(S3, OUTPUT);
  pinMode(sensorOut, INPUT);
  // Setting frequency-scaling to 20%
  digitalWrite(S0, HIGH);
  digitalWrite(S1, LOW);
  topServo.attach(7);
  bottomServo.attach(8);
  Serial.begin(9600);
}
void loop() {
  topServo.write(115);
  delay(500);
  
  for(int i = 115; i > 65; i--) {
    topServo.write(i);
    delay(2);
  }
  delay(500);
  
  color = readColor();
  delay(10);  
  switch (color) {
    case 1:
    bottomServo.write(50);
    c_red++; 
    break;
    case 2:
    bottomServo.write(75);
    c_orange++;
    break;
    case 3:
    bottomServo.write(100);
    c_green++;
    break;
    case 4:
    bottomServo.write(125);
    c_yellow++;
    break;
    case 5:
    bottomServo.write(150);
    c_brown++;
    break;
    case 6:
    bottomServo.write(175);
    c_blue++;
    break;
    
    case 0:
    break;
  }
  delay(300);
  
  for(int i = 65; i > 29; i--) {
    topServo.write(i);
    delay(2);
  } 
  delay(200);
  
  for(int i = 29; i < 115; i++) {
    topServo.write(i);
    delay(2);
  }
  color=0;
}
// Custom Function - readColor()
int readColor() {
  // Setting red filtered photodiodes to be read
  digitalWrite(S2, LOW);
  digitalWrite(S3, LOW);
  // Reading the output frequency
  frequency = pulseIn(sensorOut, LOW);
  int R = frequency;
  // Printing the value on the serial monitor
  Serial.print("R= ");//printing name
  Serial.print(frequency);//printing RED color frequency
  Serial.print("  ");
  delay(50);
  // Setting Green filtered photodiodes to be read
  digitalWrite(S2, HIGH);
  digitalWrite(S3, HIGH);
  // Reading the output frequency
  frequency = pulseIn(sensorOut, LOW);
  int G = frequency;
  // Printing the value on the serial monitor
  Serial.print("G= ");//printing name
  Serial.print(frequency);//printing RED color frequency
  Serial.print("  ");
  delay(50);
  // Setting Blue filtered photodiodes to be read
  digitalWrite(S2, LOW);
  digitalWrite(S3, HIGH);
  // Reading the output frequency
  frequency = pulseIn(sensorOut, LOW);
  int B = frequency;
  // Printing the value on the serial monitor
  Serial.print("B= ");//printing name
  Serial.print(frequency);//printing RED color frequency
  Serial.println("  ");
  delay(50);
  if(button==1){
    color = 1; // Red
    c_red++;
  }
  if(R<60 & R>49 & B<86 &B>72){
    color = 2; // Orange
  }
  if(R<80 & R>68 & G<79 & G>60){
    color = 3; // Green
  }
  if(R<48 & R>39 & G<64 & G>54){
    color = 4; // Yellow
  }
  if(R<92 & R>76 & B<93 & B>74){
    color = 5; // Brown
  }
  if (G<84 & G>76 & B<59 &B>44){
    color = 6; // Blue
  }
  return color;  
}````

If your question is will this code work with Blynk then yes.

  1. Find some general working code. Looks like yo have this.
  2. Test the most basic Blynk sketch available for your hardware.
  3. Combine 1 and 2 with BlynkTimer as per PUSH_DATA example.

I have tried to combine 1 and 2.
but it dint work as expected. looks like the BlynTimer is the solution.
can i ask one more question?
is it only Blynk.run(); and timer.run() can be inside the void loop?

Ideally for beginners, yes.

if the answer is yes, how can i loop the code(inside the void loop) as i stated above?

timer.run() with it’s other components as per the example I quoted does all this for you.