BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

I'm in trouble using notification TnT


#1

I’m trying to make a cell counter with arduino.
I want to get notification when ball1>10.
Please help me TT.

int cds=A2;
int fsr=A0;
int raser=A1;
int raser2=A3;
int led=12;
int emitter;
int total=0;
bool fault=false;
int force;
int temp;
int maxforce=0;
bool check=false;
bool check2=false;
int maxraser1;
int maxraser2;
int total2=0;
int ball1=0;
int ball2=0;
int ball3=0;
void outforce();  //
void outcds();   //
void outspeed(); //
#define BLYNK_PRINT Serial
#include "Timer.h" 
#include <BlynkSimpleStream.h>
#include <SoftwareSerial.h>
#include "blynk.h"
#include <string.h>

Timer t;

void callMeLater() {
Blynk.virtualWrite(V0, ball1);
  Blynk.virtualWrite(V3, total);
    Blynk.virtualWrite(V1, ball2);
  Blynk.virtualWrite(V2, ball3);
}

char auth[] = "3929b2efbddd4ba7ad379487b50f3eea";
SoftwareSerial SwSerial(2, 3); // RX, TX 
void setup()
{ pinMode(cds, INPUT);
  pinMode(fsr, INPUT); //
  pinMode(raser, INPUT);
  pinMode(raser2, INPUT);  
  SwSerial.begin(19200);
  Serial.begin(19200);
  Blynk.begin(SwSerial, auth); //
  t.every(1000, callMeLater); //
  }

void loop() {
  outcds();
 outforce();
 outspeed();
 
   
  Blynk.run();
  t.update();

  
}
void outforce()
{ 
  force=analogRead(fsr);
  if(maxforce<=force)
  {
    maxforce=force;
  }
  
  if(force<10)
  {
    if(maxforce>=200 && maxforce<=400)
    {
      ball3=ball3+1;
    }
    else if(maxforce<800 && maxforce>500)
    {
      ball2=ball2+1;
    }
    else if(maxforce<=100 && maxforce>10)
    {
      ball1=ball1+1;
    }
  
    maxforce=0;
  }
  }
void outcds()
  {
    emitter=analogRead(cds);
  
  if(emitter<400 && fault==false)
  {
    
    fault=true; 
  }
  else if(emitter>400 && fault==true)
  {
    total++;
    fault=false;
    
  }
  
  }
  void outspeed()
  {
    int value=analogRead(raser);
    int value2=analogRead(raser2);
    if(maxraser1<=value)
    {
     maxraser1=value; 
    }
    if(maxraser2<=value2)
    
      {
        maxraser2=value2;
        }
        if(maxraser1>60)
        {
          check=true;
        }
        if(maxraser2>60)
        {
          check2=true;
        }
        if(check==true && check2==true)
        {
          total2++;
          check=false;
          check2=false;
        }
      }

#2

Welcome

First, it is apparent you have NOT read the Welcome Topic…

As you probably are unable to edit posts yet, I have fixed your posted code for proper viewing this time.

Secondly, we are here to help you learn how Blynk works… we generally do NOT troubleshoot your code or teach you how to program.

Thirdly, you need to study how to use timers instead of trying to run commands or functions directly in the void loop() as they run hundreds of times a second that way and can cause connection problems.

Read through the Help Center, Documentation and check out the Sketch Builder for your best chance at learning how Blynk works.

All the links are at the top right of this page (scroll up if you don’t see them)