I built a keypad that can adjust volume, play, pause, skip tracks, and control the arrow and num keys. It has some backlighting under the keys. I'd like to turn this off when the computer is off. Additionally, whenever the computer is restarted the device must be unplugged and plugged back in or the operating system will not register keypresses. Is there a way I can tell if the computer is on or if the device is connected?The keypad

| improve this question | | | | |
  • Which arduino are you using? – AMADANON Inc. Apr 18 '16 at 4:53
  • Is the device USB connected? Also, by “Is there a way I can tell if the computer is on or if the device is connected?”, do you mean a way that you yourself can tell, or the Arduino, or your PC, or some combination? – James Waldby - jwpat7 Apr 18 '16 at 6:40
  • It's an arduino micro on the inside and is powered and communicates via microusb port. Also, the preferable solution is that the arduino itself can tell if the computer is on as currently it requires no helper software to be running on the host computer and works the same on windows and osx (haven't tested linux yet). – amoose136 Apr 18 '16 at 7:21
  • Try to look in your bios or OS if there is an option to turn off the USB ports when shut down. Otherwise you will need to do it yourself: If your PC has PS2 ports, you can sense the +5V there and check if it is powered off at shutdown; otherwise you will have to open the PC and find some place which turns on only when the PC is on (e.g. the IDE cables coming from the power supply). Then you will have to setup a usb port powered by that 5V or with a transistor controlled by that voltage. I think that this will solve also the reboot problems (since the board will be initialized again at boot) – frarugi87 Apr 18 '16 at 13:55
  • What USB library are you using? LUFA? As to the unplugging, you could try adding some delay inside the setup function. – Gerben Apr 18 '16 at 14:37

Your Answer

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

Browse other questions tagged or ask your own question.