Unable to define virtual key codes

I'm trying to lower/up my volume using an arduino leonardo but I'm unable to define the virtual key code.
#define VK_VOLUME_MUTE 0xAD
#define VK_VOLUME_UP 0xAF
#define VK_VOLUME_DOWN 0xAE
the software 'arduino IDE 2.0.3' only shows the characters after the 'x' in colour. It's ignoring the '0x'.
hopeing someone can help, and thank you in advance.
Screenshot_20230109_023845

is that only an issue of displaying data on IDE? does your sketch works properly?

you can try this:
#define VK_VOLUME_MUTE (0xAD)
or
const int VK_VOLUME_MUTE = 0xAD;

check on a sketch of mine.
my values are in white, and there is only one space between value name and its value.
the sketch is working (register adress for I2C protocol, so any issue in mapping would break the code)

It because the '0x' in 0xAD is only a prefix, that tells the compiler that followed letters are hexadecimal digits. The value itself is AD, so it highlighted by color.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.