How to print different variables in a straight line? (Arduino)

I was facing this problem when I was making something in which I wanted to count how many times it turned on a led, and I wanted to print all the variables in one line but coudn't do it.

I wrote this
Serial.print("Led has been turned on ");

and the result came out like the picture below.

After trying a bit I found the solution, and that was so simple. If you want to print something in the same line then just use Serial.print and if you want to print something in a new line then use Serial.println.

After using this
Serial.print("Motion has been ditected ");
Serial.print(" Times.");

 I got the result below.

I thought it would be helpful to share. :)

No comments:

Post a Comment

Newly posted:
Reason why rich getting richer and poor getting poorer