No serial output from BLYNK_PRINT

I have seem plenty examples of serial output where Blynk is giving debug data via Serial…but I don’t get any. I’m using BLE and not wifi/Ethernet like most/all examples I’ve seen. But, nothing I’ve read indicates that should affect anything.

Basically, I can send data via Serial.print…but I get nothing from BLYNK_PRINT or BLYNK_LOG, and BLYNK_DEBUG makes no difference.

What am I missing? Thanks.

As I understand it, Blynk Debug uses the default serial port… probably more refered to as the USB/programming port.

And as it drastically slows things down, i don’t think you would even want it running over BLE (even if it is able).

Plug your device into a computer and utilize the IDE monitor or a terminal program to watch the debug statements as you test your otherwise BLE connected device.

Sorry, I didn’t clarify. The serial monitor is running across the default serial port via USB. And I see nothing. I’m simply using Blynk across BLE to control the device. Hope that clarifies.

#define BLYNK_PRINT Serial

Goes to the top of the sketch

2 Likes

Ah. So I noticed that pattern and tried it but it resulted in a build error…so I thought it was wrong…good to know it wasn’t…here’s the error:

Arduino: 1.8.1 (Mac OS X), Board: "Arduino/Genuino 101"

In file included from /Users/ajmoon/Documents/Arduino/libraries/Blynk/src/Blynk/BlynkApi.h:15:0,
                 from /Users/ajmoon/Documents/Arduino/libraries/Blynk/src/BlynkApiArduino.h:14,
                 from /Users/ajmoon/Documents/Arduino/libraries/Blynk/src/BlynkSimpleCurieBLE.h:22,
                 from /Users/ajmoon/gits/Water-top-off/Water-top-off.ino:13:
/Users/ajmoon/gits/Water-top-off/Water-top-off.ino: In function ‘void hearbeat()’:
/Users/ajmoon/Documents/Arduino/libraries/Blynk/src/Blynk/BlynkDebug.h:95:78: error: ‘BLYNK_LOG_UNAVAILABLE’ was not declared in this scope
         #define BLYNK_LOG(msg, ...)  BLYNK_LOG_UNAVAILABLE(msg, ##__VA_ARGS__)
                                                                              ^
/Users/ajmoon/gits/Water-top-off/Water-top-off.ino:334:3: note: in expansion of macro ‘BLYNK_LOG’
   BLYNK_LOG("This is my test value: %d", 10);
   ^
exit status 1
Error compiling for board Arduino/Genuino 101.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Darn… I missed that… guess I should have looked closer to his sketch :blush:

1 Like

You have these two lines at the very top (line #1 & 2) of your sketch?

#define BLYNK_PRINT Serial // Defines the object that is used for printing
#define BLYNK_DEBUG        // Optional, this enables more detailed prints

And make sure one or both don’t repeat further down.

Then this of course in your setup

Serial.begin(9600); // or whatever BAUD you need.

And finally…

…Perhaps this line is the issue for your build error… you don’t define Blynk_log

Check out the link I posted here and earlier for the DOCs about debug…

When BLYNK_PRINT is defined, you can use BLYNK_LOG to print your logs. The usage is similar to printf:
BLYNK_LOG("This is my value: %d", 10);
1 Like

Yeah…that’s no where in the docs…it says to use that with no explanation of where or how. As you can see from my code I am assuming I can kinda use it like Serial.print(). Is that not the case?

My post got messed up… you were probably reading the goofy stuffs as I was editing it :slight_smile:

Guys, not every API is available on every platform.
BLYNK_LOG is missing due to 101 limitation.
You can use Serial directly or BLYNK_LOG1, BLYNK_LOG2 … (numbers stay for count of arguments)

1 Like

@Gunner
slightly but it still makes no sense.

Based on the very limited documentation I’ve already read I think I can replace Serial.print() with BLYNK_LOG() Then, if I comment out #define BLYNK_PRINT Serial later then those will not take up CPU cycles. You seem to indicate that I need to put #define BLYNK_LOG(msg, ...) BLYNK_LOG_UNAVAILABLE(msg, ##VA_ARGS) somewhere…I’m guessing before the void setup() based on the #define. But what am I defining? can you point me to an example?

@vshymanskyy

haha…so magical commands that are in no documentation? sweet. Can you offer some sort of documentation? Because simply replacing BLYNK_LOG with BLYNK_LOG1 didn’t help anything.

@moonmeister

OK… too may different (but related) issues building here.

1st. Add the two lines mentioned, to the TOP of your sketch.

2nd. REMOVE #define BLYNK_LOG if you have it anywhere.

In fact, if you are using an Arduino 101 (of which I have no experience with) then remove any reference of BLYNK_LOG (as per @vshymanskyy).

Then once you can both compile without error and see lots and lots of text scrolling on your serial monitor… then we can work on the proper use of BLYNK_LOG, or alternate print options for whatever you need logs for in the first place :smiley:

Okay, it’s building for now. My hardware is at work and its midnight so I’ll test it when I get in (tomorrow morning) and will let you know. Thanks for the help so far @Gunner & @vshymanskyy!

okay…Blynk info is flowing both BLYNK_PRINT and BLYNK_DEBUG make a difference. What I was hoping to do was write my debug info to serial using BLYNK_LOG so that when I disable BLYNK_PRINT all my debug data goes away without having to comment out everything or wrap serial statements in IF. On the Arduino 101 what are my options? Thanks.

@moonmeister Glad to hear you are up and running again (hopefully not back to square one?)

Having used the debug, but never the Blynk_Log, and now the ‘issue’ with the 101, I will probably need to defer to @vshymanskyy or someone else to hopefully supply come coherent answer for both of us.

1 Like