aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/arduino/highbyte.rst
blob: 0682391c74df5f68b89fd8f5afef361833a1791d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.. _arduino-highbyte:

highByte(x)
===========

.. warning:: This macro is provided for compatibility with Arduino
   only.  It returns the second-least significant byte in an integral
   value.  It makes sense to call this the "high" byte on a 16-bit
   microcontroller like the Atmel chips on Arduinos, but it makes no
   sense at all on a 32-bit microcontroller like the STM32s in the
   Maple line.

   In short: we provide this so that existing Arduino code works as
   expected, but **strongly discourage its use** in new programs.

Description
-----------

(Macro) Extracts the second lowest byte of an integral data type.

Parameters
----------

**x**: a value of any integral type.

Returns
-------

Second lowest byte in **x**.

Example
-------

::

    int x = 0xDEADBEEF;
    SerialUSB.println(x, HEX); // prints "BE"

Arduino Compatibility
---------------------

The Maple version of ``highByte()`` is compatible with Arduino.

See Also
--------

-  :ref:`lowByte() <arduino-lowbyte>`