-
Notifications
You must be signed in to change notification settings - Fork 0
Using Serial With Variables
Glenn Salaman edited this page Sep 7, 2020
·
1 revision
Up until now, we've just used the serial print functionality to print constant strings, like the following:
Serial.println("Hello World!");
Serial.print and Serial.println can also take variables as their parameters, like this:
int my_number=7;
Serial.println(my_number);
This will print out a "7" to the serial monitor. It's often more useful to have some text around that number to make it more human-readable...like this:
int my_number = 7;
Serial.print("My number is ");
Serial.println(my_number);
Which will print out:
My number is 7