C++ – How to hook up LED lights in C++ without microcontroller

c++led

I want to light up/off LEDs without a microcontroller. I'm looking to control the LEDs by writing a C++ program. but the problem im having is hooking them up is there a free way to do !!!!

I'm using Windows XP if that is relevant.

I have LEDs but I don't have a microcontroller.

Well, I found some functions but their headers are not working, so can someone help me find headers?

Here is an example of what I'm talking about:

poke(0x0000,0x0417,16);
gotoxy(1,1);
printf("Num Lock LED is now on    r");
delay(10);

Also, does anyone have a "Kernel Programming" eBook?

I also need a circuit diagram to show where to hook up the LEDs.

Best Solution

That completely depends on which hardware you have, which determines which driver you need. Back then, i got a simple led and put it into the printer LPT port. Then i could write a byte to address 0x0378h and the bits in it determined whether a pin had power or not (using linux). For windows, you need a driver that allows you to access the lpt port directly. I did it with a friend back then too, and it worked nicely (we built up a traffic light :)) Read this page (click on Parallel Port on the left. For some reason, i cannot link directly to it) for details on windows. And read man outb on linux. Now, that Port is really old. But if you have some machine around that still got one, i think it's a lot of fun to play with it.

Anyway, i've got a fritz box that has a neat LED. One can connect to it via telnet and then write something (i forgot the numbers) into /proc/led iirc. A kernel driver then interprets the number and makes the right LED blink. That's another way of doing it :)