bitClear()

Descripción

Borra (escribe un 0) en un bit de una variable numérica.

Sintaxis

bitClear(x, n)

Parámetros

  • x: la variable numérica cuyo bit se quiere borrar
  • n: el bit a borrar, comenzando por 0 del bit menos significativo (más a la derecha)

Retornos

  • Ninguno

Ejemplo

Demonstrates the use of bitClear() by printing the value of a variable to the Serial Monitor before and after the use of bitClear().

void setup() { Serial.begin(9600); byte x = 0b10000100; // the 0b prefix indicates a binary constant Serial.print("BEFORE: "); Serial.println(x, BIN); // 10000100 bitClear(x, 2); // clear the third bit Serial.print("AFTER: "); Serial.println(x, BIN); // 10000000 } void loop() {}

The result in Serial Monitor:

COM6
Send
BEFORE: 10000100 AFTER: 10000000
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

ARDUINO BUY RECOMMENDATION

Arduino UNO R3
Arduino Starter Kit
Please note: These are Amazon affiliate links. If you buy the components through these links, We will get a commission at no extra cost to you. We appreciate it.

※ OUR MESSAGES