Arduino Programming Language: BitClear

Name

bitClear()

Description

The BitSet function clears a determined bit of a number at a given position.

Syntax

var = bitClear(byteValue, n)

Parameters

  • byteValue: variable where we want to set the bit
  • n: position of the bit we want to set to 0

Returns

none 

Usage

Application

Examples

//Set the variable value to 22 (b: 0010110)
int value = 22;

//x = 26 because it clears the bit number 2 (b: 0010010)
int x = bitClear(value, 2);


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc