1

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 +/-.

2 Answers2

2

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.

Jason
  • 88
  • 6
1

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 )...
Ikbel
  • 640
  • 4
  • 13
  • in my case there is no listening program, the leonardo equiv. board (irduino) is acting as a keyboard. – Stop Slandering Monica Cellio 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. – Stop Slandering Monica Cellio Nov 12 '15 at 19:47
  • I don't actually own a Mac, so my solutions are somehow limited, however, check out this page: http://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
  • Those third-party keyboards are using some sort of composite HID ( not only HID keyboard but also HID Consumer Device ). – Ikbel Nov 12 '15 at 20:07
  • thank you! it did not end up working, 0xe9 sends a "9" and 0xea sends "0" – Stop Slandering Monica Cellio Nov 12 '15 at 21:56
  • Yes, as I thought, when your arduino acts like a HID Consumer Device, and you send 0xe9 or 0xea that will trigger vol+/- .. – Ikbel Nov 12 '15 at 22:01
  • but as long as it is just a HID keyboard that won't work. – Ikbel Nov 12 '15 at 22:02