Go Down

Topic: Conditional information displayed on serial monitor (Read 1 time) previous topic - next topic

SierraGolfMike

This might be a step too far, but wondered if it was possible to change the text colour displayed on the serial monitor depending on the value of the information coming from Arduino. For instance if a sensor measures a temperature, could the text colour be changed if it rises above a certain level?

Thanks in advance!

S

pert

It's not possible with the Arduino IDE's Serial Monitor. However, if you use a terminal program that does VT100 emulation, you should be able to control color by sending the appropriate ANSI escape codes. I've never tried it but there was some discussion on the topic in the Arduino Developers mailing list.

SierraGolfMike

Can anyone help me in terms of using ANSI escape codes with Arduino? There is a Library Ansiterm.h but not sure how to get that into Arduino? Any I have done before have been ZIP files.

I can't find any sample code on how to use ANSI with Arduino

Thanks in advance

S

SierraGolfMike

I found the ansiterm library zip file, extracted and copied it into the libraries folder in Arduino and when opening up Arduino afterwards it says it's an invalid library. Any thoughts?

S

pert

Please post a link to where you downloaded the zip file from.

SierraGolfMike

Please post a link to where you downloaded the zip file from.
This is where I downloaded it from https://github.com/rklancer/ansiterm

pert

The library folder must be directly under the libraries folder, not in a subfolder. It's common for people to structure their repositories with the library is in the root so that it can be easily installed. Unfortunately that is not the case with this library. So to fix the error you just need to move the library folder up one folder level. The installed folder structure should look like this:

{sketchbook folder}
|_libraries
  |_ansiTest
     |_Ansiterm.h
     |_Ansiterm.cpp

I'm guessing yours currently looks like this:

{sketchbook folder}
|_libraries
  |_ansiterm-master
     |_ansiTest
        |_Ansiterm.h
        |_Ansiterm.cpp

Robin2

Why would one need a library to send VT100 escape codes?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

SierraGolfMike

The library folder must be directly under the libraries folder, not in a subfolder. It's common for people to structure their repositories with the library is in the root so that it can be easily installed. Unfortunately that is not the case with this library. So to fix the error you just need to move the library folder up one folder level. The installed folder structure should look like this:

{sketchbook folder}
|_libraries
  |_ansiTest
     |_Ansiterm.h
     |_Ansiterm.cpp

I'm guessing yours currently looks like this:

{sketchbook folder}
|_libraries
  |_ansiterm-master
     |_ansiTest
        |_Ansiterm.h
        |_Ansiterm.cpp

Thanks for your reply, all sorted now!

S

pert

I'm glad to hear it. Are you able to get color output on puTTY now?

SierraGolfMike

I'm glad to hear it. Are you able to get color output on puTTY now?
Yes thanks, I can get the colours working fine now! Unfortunately the library does not have a blinking option but getting the colours are a big help. Much appreciated.

Thanks again

S

SierraGolfMike

I'm glad to hear it. Are you able to get color output on puTTY now?
Why would one need a library to send VT100 escape codes?

...R
Only because I couldn't find anywhere that showed me how to write the Arduino code for the escape codes! If you could point me to a post or source, that would be great.

Thanks

S

Robin2

Only because I couldn't find anywhere that showed me how to write the Arduino code for the escape codes! If you could point me to a post or source, that would be great.
I suggested a Google search in your other Thread 2 days ago.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

SierraGolfMike

I have searched Google and can find sample code for Python Bash etc. but none for Arduino, except one line of code that did not work.

Robin2

I have searched Google and can find sample code for Python Bash etc. but none for Arduino, except one line of code that did not work.
Did you try the Google search that I suggested?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up