| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Serial_print

This version was saved 15 years, 1 month ago View current version     Page history
Saved by pabloevaristo
on March 5, 2009 at 7:10:15 am
 

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.