Function Serial: Print in Only One Line

We will teach you that it is possible to write only one Serial.print line to display several messages.

Jun 3, 2019

36706 views

46 respects

Components and supplies

1

USB-A to B Cable

1

Arduino UNO

Project description

Code

Concatenating the Serial.print () Function

arduino

Downloadable files

Connection Arduino with computer

Connection Arduino with computer

Connection Arduino with computer

Connection Arduino with computer

Comments

Only logged in users can leave comments

J-M-L

2 years ago

Dont use the String class on small micro-controllers , there is NOTHING wrong with having evlines of code, it alls ends up in the serial buffer and won’t print faster... you are just using more memory than needed which can come bite you later... stick to 3 print...

sandromesquitamecatronica

2 years ago

Good morning J-M-L, The post does not say it wrong or right, it teaches another way to write the code. Thankyou for your consideration, they are very relevant.

sandromesquitamecatronica

2 years ago

Next post will be using the function Millys().

vikonix

2 years ago

If you compare program size with 3 line (classic output) and 1 line (with String class converting) you will be wonder. Your code add about 900 bytes.

sandromesquitamecatronica

2 years ago

True.

Anonymous user

2 years ago

Very good.

sandromesquitamecatronica

2 years ago

Thankyou.

Anonymous user

2 years ago

you can use: Serial.printf(" Contando : %d Segundos \ ",x); //same line

Anonymous user

2 years ago

Can the x++ also be incorporated into that line?

sandromesquitamecatronica

2 years ago

Friend SECURED4TEP yes, you can to use x++ incorporated in the Serial.print.

sandromesquitamecatronica

2 years ago

Excellent,I'll write it down now, very good, Thankyou.

Anonymous user

2 years ago

Cara como é simples

Anonymous user

2 years ago

Muito didático, parabéns.

sandromesquitamecatronica

2 years ago

Obrigado.

Anonymous user

2 years ago

Thankyou, perfect.

sandromesquitamecatronica

2 years ago

Thankyou.

Anonymous user

2 years ago

well explained article serial plot is also a good way to represent data in graph must check https://electronicsmith.com/arduino-serial-print/

Anonymous user

2 years ago

Lembrando que concatenação de String's consome muita memória de seu Arduino, não aconselho usar este recurso sem um fim especifico como regra geral, tvz por isso não tenha na página de referencias oficial do Arduino.

Anonymous user

2 years ago

Exatamente, já ia comentar isso.

Anonymous user

5 years ago

well explained article serial plot is also a good way to represent data in graph must check https://electronicsmith.com/arduino-serial-print/

Rodrigo_Augusto_Cruz

5 years ago

Cara como é simples

Arduino_Ceara

5 years ago

Lembrando que concatenação de String's consome muita memória de seu Arduino, não aconselho usar este recurso sem um fim especifico como regra geral, tvz por isso não tenha na página de referencias oficial do Arduino.

Rodrigo_Augusto_Cruz

2 years ago

Exatamente, já ia comentar isso.

J-M-L

5 years ago

Dont use the String class on small micro-controllers , there is NOTHING wrong with having evlines of code, it alls ends up in the serial buffer and won’t print faster... you are just using more memory than needed which can come bite you later... stick to 3 print...

sandromesquitamecatronica

2 years ago

Good morning J-M-L, The post does not say it wrong or right, it teaches another way to write the code. Thankyou for your consideration, they are very relevant.

AngelaCosta

5 years ago

Muito didático, parabéns.

sandromesquitamecatronica

2 years ago

Obrigado.

Roboticamente

5 years ago

Thankyou, perfect.

sandromesquitamecatronica

2 years ago

Thankyou.

RodrigoRoger

5 years ago

Very good.

sandromesquitamecatronica

2 years ago

Thankyou.

Anonymous user

5 years ago

you can use: Serial.printf(" Contando : %d Segundos \ ",x); //same line

sandromesquitamecatronica

2 years ago

Friend Rafael, good afternoon, i tested it here, it display this error: 'class HardwareSerial' has no member named 'printf'

sandromesquitamecatronica

2 years ago

Friend SECURED4TEP yes, you can to use x++ incorporated in the Serial.print.

sandromesquitamecatronica

2 years ago

Excellent,I'll write it down now, very good, Thankyou.

Anonymous user

2 years ago

Can the x++ also be incorporated into that line?

sandromesquitamecatronica

5 years ago

Next post will be using the function Millys().

vikonix

2 years ago

If you compare program size with 3 line (classic output) and 1 line (with String class converting) you will be wonder. Your code add about 900 bytes.

sandromesquitamecatronica

2 years ago

True.