BLYNK_DEBUG print to terminal

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)Serial1.read();
    // 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) {
    terminal.println(inputString);
    //terminal.flush();

    // 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();
  led1.setValue(value);
  led2.setValue(value);
  led3.setValue(value);
  led4.setValue(value);
  led5.setValue(value);
  led6.setValue(value);
  led7.setValue(value);
  led8.setValue(value);
}



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