Arduino Programming Language: BitSet

Name

bitSet()

Description

BitSet sets to 1 a determined bit of a number.

Syntax

var = bitSet(byteVal, n)

Parameters

  • byteValue: the byte or the name of variable where it is set the bit
  • n: position of bit to set

Returns

none 

Usage

Application

Examples

int value = 22;             // it sets the variable value to 22 (b:0010110) 
int x = bitSet(value,3);   // x= 30 because it sets to 1 the bit number 3 (b:0011110)


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