SandroMesquitaJoao_ArthurPixelsEscola
Published © GPL3+

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.

BeginnerProtip28,997
Function Serial: Print in Only One Line

Things used in this project

Story

Read more

Schematics

Connection Arduino with computer

Code

Concatenating the Serial.print () Function

Arduino
int x=0;
void setup() {
  /*Inicializa a comunicao serial a uma 
  taxa de 9600 baunds por segundo*/
  Serial.begin(9600);
}

void loop() {
  /*Serial.print("Contando: ");   //Imprime a palavra "Contando"
  Serial.print(x);              //Imprime o valor da variavel x
  Serial.println(" segundos."); //Imprime a palavra " segundos."*/
  Serial.println("Contando: "+(String)x+" segundos.");
  delay(1000);                  //Espera 1 segundo
  x++;                          //Soma x+1
}

Credits

SandroMesquita

SandroMesquita

14 projects • 113 followers
Professor de robótica com Arduino e Raspberry, estudando e aplicando conhecimentos de I.A. usando a Linguagem Python como base.
Joao_Arthur

Joao_Arthur

1 project • 7 followers
PixelsEscola

PixelsEscola

14 projects • 69 followers

Comments