Writing to terminal Widget

Hi there,
I have been using a Wemos d1 mini and an Iphone 6S for my project with Blynk for some time without any problems.
However, I wanted to display the time and date from a real time clock on my
Blynk app. So I loaded the terminal widget. However, I am getting error messages
when I compile the program using the Arduino IDE and the terminal.print command.
The error message is “invalid conversion from ‘const char to int’ [-fpermissive]”
I wanted to use the terminal program so that I could clear the screen between writes.
Actually, it would be useful to have a one line text and data widget.

WidgetTerminal terminal(V10);
void timer() {
Blynk.virtualWrite(V10, "Test ");  //THIS WORKS
terminal.print(V10, "Test "); //THIS DOES NOT WORK 
}
void loop()

`
thanks in advance

You’ve already declared the terminal object as V10, so including V10 in this command is not required - in fact as you’ve discovered it’s illegal.

The correct command is simply…

terminal.print("Test ");

Pete.

Hello Pete, thanks very much for your help.
Problem solved.

1 Like

Personally, I prefer to use the Blynk.virtualWrite(V10, "Test ") approach, rather than using the terminal wrapper, as it gives more consistent results.

if you look at the WidgetTerminal.h file in the Blynk library files you’ll see that this is acting as a wrapper for terminal commands and is simply doing Blynk.virtualWrites in the background.

Pete.

Hello Pete, thanks for the update.
I have an interesting one for you.

Before I wrote to the community, I played around with the lcd display.

I took the example in the Blynk documentation and used the following:

BlynkTimer timer;
WidgetLCD lcd(V10);

//and then in the part of my sketch where I write to my app:

lcd.clear(); //THIS WORKS
lcd.print(0, 0, "TEST "); //'THIS WORKS BUT WITH AN ERROR

The result on the lcd widget display is:

P 0 0 TEST

If I understand correctly, the first 0 is character zero and the second zero - line 1. Food for thought?
Regards
John

//there is a 15 second millis delay before the lcd is cleared again.

Hello Pete,
have worked further on the terminal widget.
The command:
terminal.println();
Does not force a carriage return with or without text. The virtual pin is contained in the widget statement as discussed above.
I have had to use Blynk.virtualWrite to buffer the previous line with spaces to force a carriage return, because the previous line does not have enough characters itself.

In other words, the previous line reads “Last SD Card Write 16/10/2020 08.40” for example and the following line, the data sent to the sd card.

Best
John

I think you may need to have either an empty string, or a string containing a space for it to work, like this

terminal.println("");

or this:

terminal.println(" ");

I think an escaped new line character also works

terminal.println("\n");

and that should also work with a virtualWrite command

Blynk.virtialWrite(V10,"\n");

Pete.

Hi Pete, thanks for the help.
I tried:
terminal.print(" ");
and this does not work. I have to go out so will try the other variants later.
All the best
John

this will print a space. if you want to begin a new line then it would need to be terminal.println(" "); as I said above.

Pete.

Hello Pete, you are quite right, I needed the “ln” in order to CR.

However, I tried all these. None work except your last suggestion of:

Blynk.virtualWrite(V0, “\n”); //Worked perfectly.
this is my test. (using “V0”

terminal.flush(); //Works
terminal.clear(); //Works
Blynk.virtualWrite(V0,“test”); //to send data to terminal line 1
terminal.println("\n"); //Did not work
terminal.println(" "); //Did not work
Blynk.virtualWrite(V0, “\n”); //Worked
Blynk.virtualWrite(V0,“line 2”); //Send data to terminal line 2

Perhaps this post is not the place to raise another issue with Terminal.
If so let me know please and I will create a new post.

When my app is running, if I pause the app, or go to my emails etc, the text written to the terminal vanishes and cannot be scrolled. This happens immediately I return to the app.

As I can now manage the data going to terminal, the only issue is for Blynk to get to the bottom of why the terminal.println does not carriage return. This statement is clear in its use as in the sample sketch Blynk provide in their documentation.

Once again, thanks for your patience.
Best
John

Are you putting a terminal.flush(); as the last line after these?

It sounds like you have a workaround to the need to begin a new line in the terminal, so why not use that?

As far as the terminal clearing when the app loses focus, that was an issue we were having with the iOS version of the app previously, which was fixed in a later release. I guess you’re running the app on Android?

Pete.

Hi, yes, the writing to the terminal is working fine now.

However, the terminal clearing problem is with my Iphone 6S. I have the latest software upgrades downloaded.

Something interesting though, I changed the background colour and text for the terminal. Surprise, surprise, no matter what I tried, I then could not replicate the problem. I have not tried going back to the black background to see if this problem would return.

J

Hello Dave, thanks for your reply, yes there is a terminal.flush after those lines of code.
regards
J

There is a rather lengthy topic about an issue that was identified with version 2.25.0 (3) and beta version 2.26.0 (2) of the iOS app.

This wasn’t actually about the display clearing, but about it refreshing after an idle period or losing focus then duplicating the previous output of the terminal and causing duplication.
However, it does sound somewhat connected, and maybe the “keep alive” solution of writing ‘nothing’ to the terminal every 10 seconds would help the problem if it recurs. Here’s a link to the relevant post of using a timer to write ‘nothing’ to the terminal, but if you have a spare hour of your life that you don’t want back then you can read the whole topic…

Pete.

Hello again,
with this game, there is always something around the corner!!

Thanks for the ideas. I will try them.

However, guess what, I took my app offline in order to change a setting with terminal.
The last write to the terminal screen was visible. Then I changed the size of the terminal box. As soon as I did that the text vanished, except leaving me with two characters from the write.

There is another small issue with terminal. My main screen is full of widgets and the terminal screen only shows enough to display 2 lines at the bottom of the main screen.

In order to enlarge or reduce the size of the terminal screen, I have to first move the terminal widget down the second screen.
When the change size is enabled (shows dots to resize), if the screen is normal size then I can reduce the size of the screen. Once the screen is reduced I cannot increase the size without deleting the terminal widget and re-loading it, or moving the terminal screen down the second page and then resizing it. It will not re-size from the main page if the terminal screen position is bang up against the widget near the bottom of the main screen. This does not affect my use of the widget, only that people should be aware of the situation.

By the way, I think the Blynk service overall is fantastic.

J

I’m having the problem with the terminal clearing when the app loses focus. Using Android 1.3.13 and Blynk Cloud. The text appears fine, but disappears if you switch to another app, then return to Blynk.

Any ideas or suggestions please?

Peter

Are you sure?

If you’re using Blynk IoT then data retention has not yet been implemented in the Terminal widget.
If you do a search then you’ll find several topics on the subject.

If you’re using Blynk Legacy then it’s no longer supported.

Pete.

Thanks Pete - I should have said that’s the version number of the Android Blynk IoT app (the phone is Android 10).

Peter

Then you have your answer, that functionality is not yet implemented in Blynk IoT.

Pete.