How to stop Blynk Serial Prints

Hello,

Hey guy I want to stop blynk from Printing these lines.
I have Already removed this line #define BLYNK_PRINT Serial

but still i get the following messages on my screen.

AT
ATE0
AT+GMR
AT+CIPMUX=1
AT+CWMODE?
AT+CWJAP="Mate10L","alpha656"
AT+CIPCLOSE=1
AT+CIPCLOSE=1
AT+CIPSTART=1,"TCP","blynk-cloud.com",80
AT+CIPSEND=1,37

Those are AT commands, as in possibly to a ESP as Shield module… and not something Blynk usually prints out :thinking:

We would need to know the exact hardware and see the code you are using that displays this output.

Properly format the code after pasting it here of course :wink:

Blynk%20-%20FTFC

Hmmm… are you somehow linking your ESP as shield (I am guessing that is what you are using) to the same COM port used for programming and your serial monitor? As in using the wrong Serial/WiFi setting in your Blynk.begin() command?

EDIT - Yes, I checked your last few topics… probably using a Nano with ESP-01

And I bet in all your Blynk.config() vs Blynk.begin() experimenting you have mixed up the Serial port/link used between your debug and your ESP link. Interestingly I have never seen that happen like this before :smiley:

This Is My complete code.
This is for starting our generator automatically.

But i am now facing low memory problems

//#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#define ESP8266_BAUD 115200
ESP8266 wifi(&Serial);


 
char auth[] = "***************************************";
char ssid[] = "Mate10L";
char pass[] = "alpha656";


// Pin Declearation //

int ACCpin =  5 ;   // WAPDA Checking Pin
int GENpin = 10 ;   // GEN Checking Pin
int UPSpin = 11 ;   // UPS Power Pin
int OBBpin =  4 ;   // On Board Button
int UPSBP  =  0 ;   // UPS By Pass Button

// Variabes //

int ACCcheck  = 0 ;  // ACC Value 
int GENcheck  = 0 ;  // Gen Value
int UPScheck  = 0 ;  // UPS Value
int OBBcheck  = 0 ;  // On Board Button
int ATSonof  = 0 ;

int TATP      = 4 ;  // Total Attempts
int ATP       = 0 ;  // Current Attempt
int UPSDC     = 0 ;  // UPS Discharge Status

// Pin Outs //

int Gstart = 2 ;     // Gen Start
int Gself  = 3 ;     // Gen Self

int PowerL   = 6 ;    // Power Light
int StartL   = 7 ;    // Start Light
int OnlineL  = 8 ;    // Internet Light
int ATSonofL = 9 ;    // ATS On/Off Light



int GenONOffMOB = 0 ;
int ATSonofOR   = 0 ;


int UPSBPon    = 0 ;
int UPSBPof    = 0 ;
int GenstartOR = 0 ;
int GenstopOR  = 0 ;
int ATSon      = 0 ;
int ATSof      = 0 ;

int x=30001;
int blynkConnStat;


void setup()
{

 Serial.begin(9600);
 delay(10);
 Serial.begin(ESP8266_BAUD);
 delay(10);
 Blynk.config(wifi,auth);



  
  pinMode(Gstart , OUTPUT);
  pinMode(Gself  , OUTPUT);

  pinMode(PowerL , OUTPUT);
  pinMode(StartL , OUTPUT);
  pinMode(OnlineL, OUTPUT);
  pinMode(ATSonof, OUTPUT);
   

  pinMode(ACCpin, INPUT);
  pinMode(GENpin, INPUT);
  pinMode(UPSpin, INPUT);
  pinMode(OBBpin, INPUT);

    digitalWrite(Gself  , HIGH);
    digitalWrite(Gstart , HIGH);
}




void generatorstart()
{

  if (ATP <= TATP){
  ATP = ATP + 1;

  Serial.println("Gen Starting!!!");
  digitalWrite(Gstart,  LOW);
  digitalWrite(Gself,  LOW);
 
  delay1(3);
  
  digitalWrite(Gself,  HIGH);
  Serial.println("Attempted!!!");


  delay1(15);

         } else {

  Serial.println(ATP);

  Serial.println("attempted 4. Gen Not Start Until Reset");
  digitalWrite(Gstart, HIGH);
  digitalWrite(Gself, HIGH);
  Serial.println("");
  delay(10);
  }
}

void generatoroff()
{
  
  Serial.println("");
  Serial.println("Generator Shutting Down!!!"); 
  digitalWrite(Gstart,   HIGH);
}



void mreadings(){

  live();


  // UPS BYPASS STATUS FROM MOBILE //
    if (UPSBPon == 1 && UPSBPof == 0){

      UPSBP = 1;
    }

    if (UPSBPon == 0 && UPSBPof == 1){

      UPSBP = 0;
    }
    
    if (UPSBPon == 1 && UPSBPof == 1){

      UPSBP = 0;
    }
    
    if (UPSBPon == 0 && UPSBPof == 0){

      UPSBP = 0;
    }


    // ATS STATUS FROM MOBILE //
    if (ATSon == 1 && ATSof == 0){
      
      ATSonofOR = 1;

    }

    if (ATSon == 0 && ATSof == 1){
      
      ATSonofOR = 0;
      ATSonof = 0;
    }

    if (ATSon == 1 && ATSof == 1){
      
      ATSonofOR = 0;
    ATSonof = 0;     
    }

    if (ATSon == 0 && ATSof == 0){
      
      ATSonofOR = 0;

    }


    // Generator STATUS FROM MOBILE //
    if (GenstartOR == 1 && GenstopOR == 0){
      
      GenONOffMOB = 1;
    }

    if (GenstartOR == 0 && GenstopOR == 1){
      
      GenONOffMOB = 0;
    }

    if (GenstartOR == 0 && GenstopOR == 0){
      
      GenONOffMOB = 0;
    }

    if (GenstartOR == 1 && GenstopOR == 1){
      
      GenONOffMOB = 0;
    }

      if (ACCcheck == 1){
      Blynk.virtualWrite(V1, 255); // WAPDA
  }
    if (ACCcheck == 0){
      Blynk.virtualWrite(V1, 0); // WAPDA
  }


  if (GENcheck == 1){
      Blynk.virtualWrite(V2, 255); // UPS
  }
    if (GENcheck == 0){
      Blynk.virtualWrite(V2, 0); // UPS
  }


  if (UPScheck == 1){
      Blynk.virtualWrite(V3, 255); // GEN
  }
    if (UPScheck == 0){
      Blynk.virtualWrite(V3, 0); // GEN
  }
}


void readings()
{
  
  ACCcheck = digitalRead(ACCpin); 
  delay (50);
  GENcheck = digitalRead(GENpin);  
  delay (50);
  UPScheck = digitalRead(UPSpin); 
  delay (50);
  OBBcheck = digitalRead(OBBpin);  
  delay (50);


  
 if (OBBcheck == 1){
  ATSonof = 1;
 }

 if (OBBcheck == 0){
  ATSonof = 0;
 }

 if (blynkConnStat == 1){
  mreadings();
 }

  Serial.println("_____________________________________________");
  
  Serial.print("             ACCcheck         = ");
  Serial.println(ACCcheck);
 
  Serial.print("             GENcheck         = ");
  Serial.println(GENcheck);
  
  Serial.print("             UPScheck         = ");
  Serial.println(UPScheck);
  
  Serial.print("             OBBcheck         = ");
  Serial.println(OBBcheck);
  
  Serial.print("             UPSBP            = ");
  Serial.println(UPSBP);
 
  Serial.print("             UPSBDC           = ");
  Serial.println(UPSDC);

  Serial.print("          Gen ON Off MOB      = ");
  Serial.println(GenONOffMOB);
  
  Serial.print("          ATS ON OFF OR       = ");
  Serial.println(ATSonofOR); 

  Serial.println("_____________________________________________");

  
}

void logics()
{

 if (ATSonof == 1 || ATSonofOR == 1){

    digitalWrite (ATSonofL , HIGH);

  if ( ACCcheck == 0 && UPSBP == 1 && GENcheck == 0){
  Serial.println("");
  Serial.println("1WAPDA IS OFFLINE!");
  Serial.println("UPS IS BYPASSED");
  Serial.println("Starting Generator.");
  generatorstart();
  Serial.println(""); 
  loop();
  }

  if ( ACCcheck == 0 && UPScheck == 0 && GENcheck == 0){
  Serial.println("");
  Serial.println("2WAPDA IS OFFLINE!");
  Serial.println("UPS IS NOT BYPASSED");
  Serial.println("UPS IS DISCHARGED");
  Serial.println("Starting Generator.");
  generatorstart();
  Serial.println("");
  UPSDC=1;
  loop();
  }

  if ( ACCcheck == 0 && UPSBP == 1 && GENcheck == 1){
  Serial.println("");
  Serial.println(" 3Generator Started Sucessfully!!");
  Serial.println("Now System Will Reset Number of Attempts");
  ATP=0;
  Serial.println("");
  loop();
  }

  if ( ACCcheck == 0 && UPScheck == 0 && GENcheck == 1){
  Serial.println("");
  Serial.println(" 4Generator Started Sucessfully!!");
  Serial.println("Now System Will Reset Number of Attempts");
  ATP=0;
  Serial.println("");
  UPSDC=1;
  loop();
  }

  if ( ACCcheck == 1 && GENcheck == 1){
  Serial.println("");
  Serial.println("5WAPDA IS NOW ONLINE");
  Serial.println("GENERATOR WILL NOW STOP");
  UPSDC=0;
  generatoroff();
  loop();
  }

  if ( ACCcheck == 0 && UPScheck == 1 && UPSBP == 0 && GENcheck == 1 && UPSDC == 0){
  Serial.println("");
  Serial.println("6UPS IS NOW ONLINE");
  Serial.println("GENERATOR WILL NOW STOP");
  generatoroff();
  loop();
  }

  if ( ACCcheck == 1 && GENcheck == 0){
  Serial.println("");
  Serial.println("7GENERATOR IN NOW SUCESSFULLY STOPPED");  
  UPSDC=0;
  loop();  
  }

  if ( ACCcheck == 0 && UPScheck == 1 && UPSBP == 0 && GENcheck == 0){
  Serial.println("");
  Serial.println("8GENERATOR IN NOW SUCESSFULLY STOPPED");     
  loop();
  }
  }
}

void live()
{
  

    if (blynkConnStat == 0 && x > 30000  ){
      Serial.println("Connecting...");
      Blynk.connectWiFi(ssid, pass);
      Blynk.connect();
      Serial.println(blynkConnStat);
      x=0;
    }

   blynkConnStat = Blynk.connected();
   x++;
    
   if (blynkConnStat == 1){
   Blynk.run();
   }
}

void livestatus()
{

   if (blynkConnStat == 1){
   Serial.println("Connected Sucessfully.");
   }

   if (blynkConnStat == 0){
   Serial.println("Not Connected.");
   }
}


void delay1(int d)
{
  int y = d * 1000;
  int z = y / 250;

  for (int x= 0; x <= z; x++)
  {
  delay(250);
  live();
  }
}

void loop()
{

  live();

  livestatus();

  delay1(2);

  readings();

  logics(); 


}

    


BLYNK_WRITE(V4) {

 int pinValue = param.asInt();

 if (pinValue == 1) {
 UPSBPon = 1;
  } else {
 UPSBPon = 0;
  }
}

BLYNK_WRITE(V8) {

 int pinValue = param.asInt();

 if (pinValue == 1) {
 UPSBPof = 1;
  } else {
 UPSBPof = 0;
  }
}

BLYNK_WRITE(V5) {

 int pinValue = param.asInt();

 if (pinValue == 1) {
 ATSon = 1;
  } else {
 ATSon = 0;
  }
}

BLYNK_WRITE(V9) {

 int pinValue = param.asInt();

 if (pinValue == 1) {
 ATSof = 1;
  } else {
 ATSof = 0;
  }
}

BLYNK_WRITE(V6) {

 int pinValue = param.asInt();

 if (pinValue == 1) {
 GenstartOR = 1;
  } else {
 GenstartOR = 0;
  }
}

BLYNK_WRITE(V7) {

 int pinValue = param.asInt();

 if (pinValue == 1) {
 GenstopOR = 1;
  } else {
 GenstopOR = 0;
  }
}

This is your problem… Serial references the primary programming & diagnostic (serial monitor) port of your Arduino… you cannot use that as well as for the ESP-01 without a lot of due diligence like unplugging the Arduino from the PC everytime it tries to boots, and unplugging the ESP everytime you want to program it.

Unfortunately, I see that the correct way is NOT as demonstrated in the Help Center files for that type of connection :face_with_raised_eyebrow:

Instead you need to “add” another serial port for the ESP-01 link with SoftSerial and wire your ESP to those pins instead… then follow a connection setup like in this corrected example from the Example Builder for your hardware config…

Connecting pin 2 (RX) on the Arduino to TX on the ESP-01.

And Pin 3 (TX) on the Arduino to RX on the ESP-01 (You probably should use a voltage divider for this, but I have often done it directly without any problems, since the signal is rarely at full HIGH/5v voltage for any discernible time, and the pins are reportedly somewhat 5v safe…ish :stuck_out_tongue_winking_eye: ).

#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

char auth[] = "YourAuthToken";
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

// Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);

void setup() {
  // Debug console
  Serial.begin(9600);

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
}

void loop() {
  Blynk.run();
}
1 Like

There are so many things wrong with what you’re doing in your code, you’ll almost certainly sufferer Blynk disconnections and unresponsiveness - mostly due to what you’re doing in your void loop and the delay1 function that you’ve created.

However, once you sort all of that out, there are a few ways to save memory…

Your variables that don’t change (things like pin numbers and parameterised values) can be replaced with static integers which require less memory. Those that do change but that have a maximum value of 255 can be replaced with byte variables, which also require less memory than integers.

You should use the ‘F Macro’ in your serial print statements that contain only text (you have a lot of these).

Serial.println("Generator Shutting Down!!!"); 

would become:

Serial.println(F("Generator Shutting Down!!!")); 

This can only be used for Serial.print and Serial.println statements that contain no variables.

Pete.

2 Likes

I was somewhat unaware of that… Achievement acquired, got out of bed and learned something :smiley:

2 Likes

F Macro Giving Errors



    void setup() {
     Serial.begin(9600);
    }

    void loop() {
    Serial.println(F(“Hello World”));

    }
    sketch_may29a:7:1: error: stray '\342' in program

     Serial.println(F(“Hello World”));

     ^

    sketch_may29a:7:1: error: stray '\200' in program

    sketch_may29a:7:1: error: stray '\234' in program

    sketch_may29a:7:1: error: stray '\342' in program

    sketch_may29a:7:1: error: stray '\200' in program

    sketch_may29a:7:1: error: stray '\235' in program

    In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,

                     from sketch\sketch_may29a.ino.cpp:1:

    C:\Users\VLAD\Documents\Arduino\sketch_may29a\sketch_may29a.ino: In function 'void loop()':

    sketch_may29a:7:21: error: 'Hello' was not declared in this scope

     Serial.println(F(“Hello World”));

                         ^

    C:\Users\VLAD\Documents\Arduino\sketch_may29a\sketch_may29a.ino:7:16: note: in expansion of macro 'F'

     Serial.println(F(“Hello World”));

                    ^

    sketch_may29a:7:27: error: expected ')' before 'World'

     Serial.println(F(“Hello World”));

                               ^

    C:\Users\VLAD\Documents\Arduino\sketch_may29a\sketch_may29a.ino:7:16: note: in expansion of macro 'F'

     Serial.println(F(“Hello World”));

                    ^

    exit status 1
    stray '\342' in program

Sorry My bad wrong commas.:stuck_out_tongue_winking_eye:

2 Likes

You also used the wrong method of formatting your vode… you need to manually enter in the three backticks for and aft of your posted code… not use any of the “quick edit” buttons.

Anyhow, are you saying you fixed your compiling error?

This is now working fine.
the problem was with this “ while I have to use this " .

Now

Serial.println (F("Hello Worldads"));

Was

Serial.println(F(“Hello World”));

The Difference is in the double quotes.
sorry for my english.

Yes… We have seen that “typeset” glitch before. That is one of the reasons we push the proper formatting, as the incorrect quotes can often be displayed without it… thus ending up with compiling errors for those that copy the code from the topics.

Glad you caught it… my first time running into that had me losing some hair before noticing the misleading quote :blush:

1 Like

Dear Gunner,

Please dont mind but I had to ask. Do you work for blynk ?

1 Like

No problem asking :slight_smile:

No, I am simply a long term user (sounds like an addiction :laughing:) and forum volunteer… who happens to spend way too much time here :blush:

Great Hats Off To Your Services Brother.:clap: you are a real life saver to alot of people…