Emulating Sleep keystrokes in MAC(OSX) on AIR

Hi,

I am trying to emulate OSX Sleep steps on MAC Air.

Iam able to quit and lock using this:

Keyboard.press(KEY_LEFT_GUI);
// Shift-Q logs out:
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press('Q');
delay(100);
Keyboard.releaseAll();
// enter:
Keyboard.write(KEY_RETURN);

But i jus want to sleep the screen , I tried :

Keyboard.press(KEY_LEFT_CTRL);
// Shift-Q logs out:
Keyboard.press(KEY_LEFT_SHIFT);
//Keyboard.press('Q');
Keyboard.press(KEY_POWER);
delay(100);
Keyboard.releaseAll();
// enter:
Keyboard.write(KEY_RETURN);

here byte KEY_POWER =byte(0x66);

I am using Atmega 32u4 in BlenMicro BLE board. Can someone give me inputs ?

navaljosh:
here byte KEY_POWER =byte(0x66);

That’s ‘f’.

You need to add 0x88 to the keycode:
KEY_POWER = 0x66 + 0x88

wowooooo it worked :smiley: