Framework (A-Z)

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Name

bit()

Examples
// Declare variable "a" and assigns a number 
// with the bit 0 set to 1: 00000001 (1 in decimal)
byte a = bit(0);	

// Declare variable "b" and assigns a number 
// with the bit 2 set to 1: 00000100 (4 in decimal)
byte b = bit(2);
Description The bit command returns a byte with the requested bit set to 1.
Syntax
var = bit(value)
Parameters
value int: the bit to set to 1 (can be from 0 to 7)
var byte: a byte variable to assign the value returned by the bit command
Usage Application
Related bitRead()
bitWrite()
lowByte()
highByte()
makeWord()
Updated on July 07, 2011 11:07:51pm PDT

Creative Commons License