Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
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.

BeginnerProtip29,223
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
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
1 project • 7 followers
PixelsEscola
14 projects • 69 followers

Comments