I saw this answer but I can't find the analog for Mac.

I've tried cycling thru keycodes from 0x01 thru maybe 0x500, and I went thru ascii a few times, also found brightness up/down, and F11, F12, but they get pressed with fn key by default which makes them do operations other than vol +/-.

  • What makes you think that the upvoted answer in the other question doesn't apply to Macs? Nov 11 '15 at 20:51
  • @IgnacioVazquez-Abrams 1) I tried those codes 2) I can't find xev for mac. Nov 12 '15 at 19:45

Could you just untick the "Use all F1, F2, …" in System Preferences -> Keyboard?

enter image description here

Just wondering if that would be an option and if doing so would create the desired outcome.


Unfortunately, Fn is hardware and it is handled internally by the keyboard to do something hardware-based without sending any code. So the short answer is: you can't simulate Fn key with arduino.

What I think of as a solution is:

  • Create a program on your Mac that can listen for keyboard scan codes to do vol +/- or any other function.
  • Send a custom scan code from Arduino to your Mac ( a scan code that isn't part of the standard scan codes ).
  • When your listening program receives that code, it should do Vol +/- (or anything else )...
  • in my case there is no listening program, the leonardo equiv. board (irduino) is acting as a keyboard. Nov 12 '15 at 19:46
  • Oh sorry I may have misunderstood--- you mean to say create a custom mapping on the mac with keys I can send, have those alter volume, and run it along-side using the leonardo? This might work; I'm hoping to find a way to just send the keycode. I have a 3rd party USB keyboard that sends vol +/- just fine so I know keyboards can do this somehow. Nov 12 '15 at 19:47
  • I don't actually own a Mac, so my solutions are somehow limited, however, check out this page: lists.apple.com/archives/usb/2011/Aug/msg00020.html
    – Ikbel
    Nov 12 '15 at 19:58
  • 1
    It does say : " Usage 233 (0xe9) [volume up], Usage 234 (0xea) [volume down]"
    – Ikbel
    Nov 12 '15 at 19:59
  • You might want to try these codes and see if that does something ...
    – Ikbel
    Nov 12 '15 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.