7

I want to create a program to represent binary numbers using the keyboard's LEDs. How can I control those LED lights using the C language?

3
  • 4
    Language does not matter that much, operating system is more important. Which operating system?
    – Jan Hudec
    Commented Oct 10, 2012 at 8:10
  • 2
    Are you using a PC ? Then read about port programming.
    – shan
    Commented Oct 10, 2012 at 8:10
  • 2
    @shan: Port programming? Operating systems won't let you touch those these days!
    – Jan Hudec
    Commented Oct 10, 2012 at 8:11

2 Answers 2

2

For Linux, this would be helpful

setleds

A more comprehensive internals and several command line utilities description

Keyboard and console - HowTo.pdf

1

For Windows:

Because the SetKeyboardState function alters the input state of the calling thread and not the global input state of the system, an application cannot use SetKeyboardState to set the NUM LOCK, CAPS LOCK, or SCROLL LOCK (or the Japanese KANA) indicator lights on the keyboard. These can be set or cleared using SendInput to simulate keystrokes.

See the Windows API ref.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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