serial print arduino code example
Example 1: arduino format specifiers
* %d = signed integer %f = floating point number
* %s = string %.1f = float to 1 decimal place
* %c = character %.3f = float to 3 decimal places
* %e = scientific notation %g = shortest representation of %e or %f
* %u = unsigned integer %o = unsigned octal
* %x = unsigned hex (lowercase) %X = unsigned hex (uppercase)
* %hd = short int %ld = long int
* %lld = long long int
Example 2: arduino print array
for(int i = 0; i < size_of_myArray; i++)
{
Serial.println(myArray[i]);
}
Example 3: arduino serial write
/*
Writes binary data to the serial port. This data is sent as a byte or series of bytes; to send the characters representing the digits of a number use the print() function instead.
Syntax
Serial.write(val)
Serial.write(str)
Serial.write(buf, len)
Parameters
Serial: serial port object.
val: a value to send as a single byte.
str: a string to send as a series of bytes.
buf: an array to send as a series of bytes.
len: the number of bytes to be sent from the array.
*/