Serial.print(dato)
Descripción
Imprime en el puerto serie un valor (dato).
Normálmente veremos su salida por pantalla para hacer el seguimiento de un programa. Para ello abriremos el monitor serie en el entorno Arduino.
IMPORTANTE: Para su correcto funcionamiento necesitamos inicializar el puerto serie al principio del programa ( Serial.begin(9600) )
Estructura
data: all integer types, including char
Parámtero data puede ser cualquier tipo de entero, incluyendo el tipo char.
Serial.print(b) sin especificar formato imprime b como decimal en una cadena ASCII
int b = 79; Serial.print(b);
Imprime la cadena ASCII "79".
Serial.print(b, DEC) Imprime b como un número decimal en ASCII
int b = 79; Serial.print(b, DEC);
Imprime "79".
Serial.print(b, HEX) imprime b en hexadecimal prints b as a hexadecimal number in an ASCII string. For example,
int b = 79; Serial.print(b, HEX);
prints the string "4F".
Serial.print(b, OCT) prints b as an octal number in an ASCII string. For example,
int b = 79; Serial.print(b, OCT);
prints the string "117".
Serial.print(b, BIN) prints b as a binary number in an ASCII string. For example,
int b = 79; Serial.print(b, BIN);
prints the string "1001111".
Serial.print(b, BYTE) prints b as a single byte. For example,
int b = 79; Serial.print(b, BYTE);
returns the string "O", which is the ASCII character represented by the value 79. For more information see the ASCII table.
Serial.print(str) if str is a string or an array of chars, prints str as an ASCII string. For example,
Serial.print("Hello World!");
prints the string "Hello World!".
Comments (0)
You don't have permission to comment on this page.