tags:

views:

1221

answers:

7

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.

A: 

Well you want to look for a development kit in microelectronics. I'm going to take a punt at this and say that you're not familiar with electronics?

Microcontrollers aren't anything to be scared of and if you get a nice dev kit one from Atmel or Microchip then the manual and templates they give you are extremely straightforward. But you will need SOME kind of hardware beyond the 12c led's to do this.

Could you perhaps provide more info on what you want to do? If you just want to time how often the lights turn on and off I could give you a simple circuit thats idiot proof.

Spence
Please do im looing for any source i can get in C++ of course but starting is first step
H4cKL0rD
+2  A: 

You're gonna have to give us some more details. What kind of computer, what operating system, etc.

You're probably going to need to at least buy some LEDs and a little bit of stuff.

Charlie Martin
+5  A: 

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 :)

Johannes Schaub - litb
+4  A: 

Playing with microcontrollers is fun. The arduino is an open source board with nice development tools. Some boards like this one start at around $15

Martin Beckett
+2  A: 

This CodeProject article Controlling LEDs with Parallel Port might be of interest.

Mitch Wheat
A: 

On Windows this will toggle the lights on your keyboard:

(eg. Scroll-lock light)

INPUT input[2];
ZeroMemory(input, sizeof(input));        
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = VK_SCROLL;
input[1].type = INPUT_KEYBOARD;
input[1].ki.wVk = VK_SCROLL;
input[1].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(2, input, sizeof(INPUT));
Jimmy J
what language is this?
H4cKL0rD
C ................
Jimmy J
k ok thx for telling
H4cKL0rD
srry i know it was newby but never seen some of those commands
H4cKL0rD
A: 

You need a driver that has proper privileges to talk to the ports - start here: http://www.beyondlogic.org/porttalk/porttalk.htm

Also check out http://www.lvr.com/parport.htm#Programming for more programming resource on how to access the parallel port.

Adam Davis