Diferencia entre revisiones de «bitWrite()»

De ArduWiki
Saltar a: navegación, buscar
(Vea también)
(Ejemplo)
 
(No se muestran 3 ediciones intermedias del mismo usuario)
Línea 19: Línea 19:
  
 
== Ejemplo ==
 
== Ejemplo ==
<pre>
+
<syntaxhighlight lang="c++">
</pre>
+
byte pinState = 0;            //Inicialisa todos los pines a LOW (B00000000)
 +
bitWrite(pinState, 0, HIGH);  //Pone el 1er pin en HIGH, pinState = B00000001
 +
bitWrite(pinState, 3, HIGH);  //Pone el 3er pin a HIGH, pinState = B00001001
 +
bitWrite(pinState, 0, LOW);    //Pone el 1er pin a LOW, pinState = B00001000
 +
</syntaxhighlight>
  
 
== Vea también ==
 
== Vea también ==
* [[bit()]]
+
<categorytree mode=all>Funciones bit y byte</categorytree>
* [[bitClear()]]
+
<categorytree mode=all>Operador bit a bit</categorytree>
* [[bitRead()]]
 
* [[bitSet()]]
 
* [[highByte()]]
 
* [[lowByte()]]
 
* [[shiftIn()]]
 
* [[shiftOut()]]
 
  
== Referencias ==
+
== Referencias externos ==
 
* [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 bit y byte]]

Revisión actual del 19:39 17 jul 2019

Descripción

Sobrescribe un bit según el valor ingresado.

Sintaxis

bitWrite(variable, n, valor);

Parámetros

variable
Variable numerica a evaluar.
n
bit a escribir.
valor
valor bool (o el resultado de "diferente de cero" cuando se ingresa un dato de otro tipo) a escribir en el bit.

Retornos

Nada.

Advertencias

Nada.

Ejemplo

byte pinState = 0;             //Inicialisa todos los pines a LOW (B00000000)
bitWrite(pinState, 0, HIGH);   //Pone el 1er pin en HIGH, pinState = B00000001
bitWrite(pinState, 3, HIGH);   //Pone el 3er pin a HIGH, pinState = B00001001
bitWrite(pinState, 0, LOW);    //Pone el 1er pin a LOW, pinState = B00001000

Vea también


Referencias externos