Diferencia entre revisiones de «byte()»

De ArduWiki
Saltar a: navegación, buscar
(Ejemplo)
(Referencias)
Línea 49: Línea 49:
 
* [[float()]]
 
* [[float()]]
  
== Referencias ==
+
== Referencias externas ==
 
* [https://www.arduino.cc/reference/es/language/functions/time/millis/ Guia de referencia de Arduino]
 
* [https://www.arduino.cc/reference/es/language/functions/time/millis/ Guia de referencia de Arduino]
  
[[Category:Funciones]]
+
[[Category:Funciones conversion]]

Revisión del 17:34 11 jun 2019

Descripción

Convierte un valor en un dato tipo byte.

Sintaxis

byte(variable);

Parametros

variable
una variable de tipo String.

Retorna

Retorna un numero tipo byte.

Advertencias

No funciona con cadenas string ni objetos String.

Ejemplo

char a = 'A';
byte b = 123;

void setup(){
   Serial.begin(9600);

   byte valor1 = byte(a);
   Serial.println(valor1);         //65

   int valor2 = long(b);
   Serial.println(valor2);        //123

   unsigned int valor3 = word(b); //123
   Serial.println(valor3);

   long valor4 = long(b);         //123
   Serial.println(valor4); 
}
 
void loop(){
   //Nada.
}

Vea también

Referencias externas