如何在C ++中挂接LED灯而无需单片机? [英] How to hook up LED lights in C++ without microcontroller?

查看:339
本文介绍了如何在C ++中挂接LED灯而无需单片机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在没有微控制器的情况下点亮/关闭LED。我想通过编写一个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 !!!!

如果相关的话,我使用的是Windows XP。

I'm using Windows XP if that is relevant.

我有LED,但我没有微控制器。

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?

我还需要一个电路图来显示连接LED的位置。

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

推荐答案

这完全取决于你有哪些硬件,它决定了你需要哪个驱动程序。那时,我得到了一个简单的led,并把它放入打印机LPT端口。然后我可以写一个字节到地址0x0378h,它的位确定一个引脚是否有电源(使用linux)。对于Windows,您需要一个驱动程序,您可以直接访问lpt端口。我也和朋友一起做了,它工作得很好(我们建立了一个红绿灯:))阅读本页(点击左边的并行端口。由于某些原因,我不能直接链接到它)有关窗口的详细信息。并在linux上阅读 man outb 。现在,港口真的老了。但如果你有一些机器,仍然有一个,我认为这是一个很大的乐趣,玩它。

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.

无论如何,我有一个有一个整齐的LED的弗里茨盒子。可以通过 telnet 连接到它,然后在 / proc / led iirc中写入一些东西(我忘记了数字)。然后内核驱动程序解释该数字,并使正确的LED闪烁。这是另一种做法:)

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

这篇关于如何在C ++中挂接LED灯而无需单片机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆