highByte()

Descrição

Extrai o byte mais significativo (o mais à esquerda) de uma word (valor de 16 bits), ou o segundo byte menos significativo de um tipo de dado maior.

Sintaxe

highByte(x)

Parâmetros

  • x: um valor de qualquer tipo

Retorna

byte

Código de Exemplo

void setup() { Serial.begin(9600); // setup serial int variable = 7982; Serial.print("VARIABLE: "); Serial.println(variable, HEX); // in hex format byte high_byte = highByte(variable); Serial.print("HIGH_BYTE: "); Serial.println(high_byte, HEX); // in hex format } void loop() { }

The result in Serial Monitor:

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
Arduino Uno
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino Uno' on 'COM15')
New Line
9600 baud
VARIABLE: 1F2E HIGH_BYTE: 1F
Ln 11, Col 1
Arduino Uno on COM15
2

Ver Também

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 .

※ OUR MESSAGES