many mac keyboards have a power button. Is there a way to mimic this power button shortcut from an arduino?
-
3Perhaps you could be clear what you mean by "mimic". Do you want your Arduino to be able to turn on (or off) your Mac without manual intervention?Greg Hewgill– Greg Hewgill2014年07月02日 20:57:18 +00:00Commented Jul 2, 2014 at 20:57
-
2Also, what keyboard? Some Mac laptops have a power button for the computer, where others have one to shut off the wireless keyboard.Anonymous Penguin– Anonymous Penguin2014年07月02日 21:21:53 +00:00Commented Jul 2, 2014 at 21:21
-
You have to research HID keyboard codes and its protocol. The power button is a regular key on the keyboard with a specific key code and specific a data frame. Leonardo can probably do it, most somewhat older design Arduino's can't act as a USB HID.jippie– jippie2014年07月03日 05:04:24 +00:00Commented Jul 3, 2014 at 5:04
-
The Arduino can emulate a keyboard from which you can send a series of keystrokes to turn off the computer. Not sure you'll be able to mimic the hardware button. There are a few questions that are related: arduino.stackexchange.com/search?q=hid+is%3Aquestionsachleen– sachleen2014年07月03日 16:47:00 +00:00Commented Jul 3, 2014 at 16:47
-
I have a mac mini rack holder that has a front panel with power button. It connects and controls the mac mini with USB only. I want to replicate this power signal sent over the USB with an arduino instead.Brian– Brian2014年07月03日 20:08:44 +00:00Commented Jul 3, 2014 at 20:08
1 Answer 1
There are multiple ways to do that.
You could use an Arduino Leonardo as a keyboard, then send a shortcut command to shut down or sleep the computer. You can edit these from System Preferences>Keyboard>Shorcuts>Services. The keycode 0x66 does not work for mac, but may for other operating systems source
You could write a small program (I'd do it in Python) which communicates with the Arduino over the serial port and shuts down the Mac if the Arduino wants it to.
You could sacrifice an USB keyboard and use a relay to "press" the power key.