BLYNK_DEBUG print to terminal

Do you mean like this :slight_smile:

this guy… :heart_eyes:

Is that showing all DEBUG data? If so yes.

Ah, yes… but as we normally ask… @Costas Do you have any code to back up what you are showing us? :stuck_out_tongue: (as in proper order of required commands)

Please :wink:

He goes quiet right after the big reveal he can do it … lol

1 Like

It was after 5am when I made the post so I then went to sleep :slight_smile:

For “sure” this is DEBUG data.

Something not quite right about that screenshot.
OK so the bottom of the “y” in Blynk is not quite in line but maybe that was just a Terminal glitch.
No it’s more than that.
Doesn’t the Blynk logo appear before the connection to the server is made?
How can the Terminal widget show this data?

1 Like

@Costas Are you playing ASCII art tricks here? There looks to be a leading space before each line.

And, as I already suspect… catch 22ish… need connection to use terminal, thus if connection down, no terminal.

Me thinks you are pulling our leg?

Hmm… or buffering text??

Got it!! :sunglasses:

Although my buffer or somthing may need to be adjusted… :confused:

After thinking about buffering… and good old Google, I found a solution’ish here:

Looks like you are getting there @Gunner

Well, best I have come up with is that the terminal is getting invalid (non-UTF-8) characters… I found some complicated conversion coding… but my head just exploded :boom: so I will save the rest for when (if) I wake up :stuck_out_tongue:


Ended up being the power supply was causing the issue. Hooked up a different one and no connection issues.

1 Like

So while everyone sleeps, Im left to figure it out on my own.

Just testing a theory here since I only have 1 esp connected to my PC at home and its performing tasks ( so I cant test for another 7 hours).

In setup, call Serial.begin() before Blynk connection.
Then setup the SerialEvent() function as per example but dont act on the new lines /n (?)
Once connected, print the inputString to terminal and then just monitor terminal with SerialEvent() ??

How close am I? lol @Gunner @Costas

I was taking a page out of @Costas “dangle a hint then leave em drooling, whilst I go have a nap” playbook… seems to keep the mystic factor elevated :wink:

I actually didn’t change much in the posted example, except stating terminal instead of serial, and calling the void terminalDisplay() with a timer.

/// these two lines added to script initialization
String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete

void serialEvent() 
  while (Serial1.available()) {
    // get the new byte:
    char inChar = (char);
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;

void terminalDisplay() // send buffer to terminal
// print the string when a newline arrives:
  if (stringComplete) {
    // clear the string:
    inputString = "";
    stringComplete = false;

Oh,. and adding the buffer after the Serial1.begin() - the 2nd serial port on my Mega.

  Serial1.begin(9600);  // Debug serial port

I still haven’t figured out the odd characters and messed up alignment… I need to move this test into it’s own project as mangling it into my main test bed is causing many much overloads :slight_smile:

@Jamin I am a little too foggy today, so I will leave it to you to drag a few more tid bits of coding knowledge from @Costas I should be back sometime later.

Ah, yes, I can see that being an issue… low/bad power will cause all sorts of communication issues, and only get worse over distance and links. Good catch! :+1: As one would not normally go down that path because of the red herring tossed in by the works here, but not there diagnosis.

Meanwhile it looks like we have hijacked this post on a quest for the Holy Grail of a Debug Terminal :blush: Feel free to chip in.

Ok all.

I had a thought that timing (e.g. BAUD rate and other communication corruption) might be more of an issue then non-UTF-8, as far as all the diamond coated question marks are concerned, and after fiddling around with different rates, I think that is in fact the case.

Unfortunately I just can not get any improvement past this stage (terminal on the app and the approximately same info on termite). I also feel part of my problem is that I am also using USB to link to the server.

BTW, the slider and LEDs are to allow me to force flood errors, so I can see something besides the top half of “Blynk” in ASCII art :slight_smile:

So unless someone else drops another breadcrumb ;)… I am tapped out of intuitive ideas.

My code, such as it is:

#define BLYNK_PRINT Serial1 // Set to 2nd serial port
#include <BlynkSimpleStream.h>
#include <SimpleTimer.h>

char auth[] = "ded729afxxxxxxx768afe46a";  // Blynk App Authorization Code - Sorry Jamin... no tricks from you today ;)

SimpleTimer timerTERMINAL;  // Setup timer for terminal

WidgetTerminal terminal(V0);
WidgetLED led1(V2);
WidgetLED led2(V3);
WidgetLED led3(V4);
WidgetLED led4(V5);
WidgetLED led5(V6);
WidgetLED led6(V7);
WidgetLED led7(V8);
WidgetLED led8(V9);

String inputString = "";  // A string to hold incoming data.
boolean stringComplete = false;  // Whether the string is complete.

void setup()
  Serial.begin(19200);  // To server (via USB Link - batch file on PC).
  Serial1.begin(57600);  // For BLYNK_PRINT.
  Blynk.begin(Serial, auth);  // Connect to Blynk - Local Server.
  inputString.reserve(200);  // String buffer - experiment with differing sizes.
  timerTERMINAL.setInterval(1000L, terminalDisplay);  // Terminal print timer.

void serialEvent() // Capture BLYNK_PRINT serial data into buffer.
  while (Serial1.available()) {
    // Get the new byte:
    char inChar = (char);
    // Add it to the inputString:
    inputString += inChar;
    // If the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;

void terminalDisplay() // Send buffered BLYNK_PRINT serial data to terminal.
  // Print the string when a newline arrives:
  if (stringComplete) {

    // clear the string:
    inputString = "";
    stringComplete = false;

BLYNK_WRITE(V1) // Lots of virtual LEDs to help cause flood errors. Slider send on release OFF.
  int value = param.asInt();

void loop()
{;  // Run internal Blynk functionality.;  // Run Timer for terminal.
  terminal.flush();  // // Ensure everything is sent to terminal.

I can’t get this code working on an ESP-12F…

Nothing comes up in the terminal that I havn’t specified in the code.

I have it running on a MEGA 2560 with Serial1 as the 2nd hardware serial port. So you would have to adjust accordingly to your setup.

And it doesn’t really work anyhow :stuck_out_tongue: I am working on something a bit more elegant… with less LED’s :wink: But right now this is becoming an exercise in knowledge as I fail to see how practical it could be, since during a connection failure, all the important data would never get to the terminal anyhow.

Yeh I changed Serial1 to Serial etc… but still nothing showed up… and dont have a Mega to test myself.

I think its time for @Costas to come to the rescue :stuck_out_tongue:

Do you have any USB 2 TTL adaptors to hook up to your ESP?

No, none :expressionless: