Diferencia entre revisiones de «bit()»

De ArduWiki
Saltar a: navegación, buscar
(Ejemplo)
(Ejemplo)
Línea 36: Línea 36:
  
 
== Ejemplo ==
 
== Ejemplo ==
Parpadea el pin digital 13.
+
Parpadea el LED a bordo (pin 13).
  
<pre>
+
<syntaxhighlight lang="c++">
 
void setup(){
 
void setup(){
   pinMode(13, OUTPUT);
+
   pinMode(LED_BUITIN, OUTPUT);
 
}
 
}
 
void loop(){
 
void loop(){
Línea 46: Línea 46:
 
   delay(500);   
 
   delay(500);   
 
}
 
}
</pre>
+
</syntaxhighlight lang>
  
 
== Vea también ==
 
== Vea también ==

Revisión del 19:31 24 jul 2018

Descripción

Calcula el valor del bit especificado por el paramtero.

bit valor
0 1
1 2
2 4
4 8
5 16
6 32
7 64

Sintaxis

bit(variable, n);

Parámetros

variable
variable a evaluar.
n
bit a calcular.

Retornos

Retorna el bit 2^n

Advertencias

Nada.

Ejemplo

Parpadea el LED a bordo (pin 13).

<syntaxhighlight lang="c++"> void setup(){

  pinMode(LED_BUITIN, OUTPUT);

} void loop(){

  PINB = bit(5);
  delay(500);  

} </syntaxhighlight lang>

Vea también

Referencias