Diferencia entre revisiones de «bit()»

De ArduWiki
Saltar a: navegación, buscar
(Vea también)
(Vea también)
Línea 46: Línea 46:
 
== Vea también ==
 
== Vea también ==
 
<categorytree mode=all>Funciones bit y byte</categorytree>
 
<categorytree mode=all>Funciones bit y byte</categorytree>
 +
 +
<categorytree mode=all>Operador bit a bit</categorytree>
  
 
* [[shiftIn()]]
 
* [[shiftIn()]]
 
* [[shiftOut()]]
 
* [[shiftOut()]]
* [[not bit a bit]] - (<nowiki>~</nowiki>)
 
* [[and bit a bit]] - (<nowiki>&</nowiki>)
 
* [[or bit a bit]] - (<nowiki>|</nowiki>)
 
* [[xor bit a bit]] - (<nowiki>^</nowiki>)
 
* [[bitshift left]] - (<nowiki><<</nowiki>)
 
* [[or bit a bit compuesto]] <nowiki>(|=)</nowiki>
 
* [[and bit a bit compuesto]] <nowiki>(&=)</nowiki>
 
* [[EEPROM]]
 
  
 
== Referencias externas ==
 
== Referencias externas ==

Revisión del 13:37 14 jul 2019

Descripción

Calcula el valor del bit especificado por el parámetro.

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

Sintaxis

bit(valor);
bit(variable);

Parámetros

valor
valor a evaluar.
variable
variable a evaluar.

Retornos

Retorna el bit 2^valor o 2^variable.

Advertencias

Nada.

Ejemplos 1

bit(2);     //4
bit(5);     //32
bit(8);     //256

Ejemplos 2

void setup(){
   Serial.begin(9600);
   for (byte i=0; i<10; i++){
      Serial.println(bit(i));
   }
}
void loop(){
   //Nada
}

Vea también



Referencias externas