bit()
Descrição
Computa o valor do bit especificado (o bit 0 é igual a 1, bit 1 igual a 2, bit 2 igual a 4, etc.).
Sintaxe
bit(n)
Parâmetros
- n: o bit o qual se deseja computar o valor
Retorna
O valor do bit.
Código de Exemplo
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
long x;
for (int n = 0; n < 16; n++) {
x = bit(n); // equivalent to x = 1 << n;
Serial.println(x, BIN);
}
}
void loop() {
}
The result in Serial Monitor:
COM6
1
10
100
1000
10000
100000
1000000
10000000
100000000
1000000000
10000000000
100000000000
1000000000000
10000000000000
100000000000000
1000000000000000
Autoscroll
Clear output
9600 baud
Newline
Ver Também
- Linguagem : bitClear()
- Linguagem : bitRead()
- Linguagem : bitSet()
- Linguagem : bitWrite()
- Linguagem : highByte()
- Linguagem : lowByte()
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |
Disclosure: Some links in this section are Amazon affiliate links. If you make a purchase through these links, we may earn a commission at no extra cost to you.
Additionally, some links direct to products from our own brand, DIYables.
Additionally, some links direct to products from our own brand, DIYables.