可编程独立按钮(硬件和软件)
我需要有一个物理按钮,按下时我的程序会注意到它。 有多种类型的 USB 按钮,可预先编程用于打开网站、关闭计算机等。我见过一些使用按钮和串口的项目。
但他们都没有“拥有一切”,即如何简单地描述如何组合硬件以及简单地描述代码。
我实际上只需要一个连接到串行端口的按钮,该按钮发送一些按钮已被按下的信号。
我知道这个问题是软件和硬件之间的交叉问题,但是当我用谷歌搜索这个问题时,我看到更多的人问这个问题,但他们都没有答案。
也许这个问题适合stackoverflow?
编辑:我的解决方案
在本例中,我的应用程序是一个查询系统,我想要一个按钮供人们打印查询票。
我刚刚拆开一个旧的 PS2 鼠标,买了一个按钮(4 美元),然后将电路板的两根电线焊接到按钮上。每个鼠标按钮都在电路板背面有一些点,我们可以将外部按钮连接到该点。
然后在我的程序中,我只是在系统范围内挂接了鼠标按钮事件来获取按下按钮的时间,在我的情况下,这台计算机专用于该程序,因此这不是问题。
I need to have a physical button that when pressed will be noticed by my program.
There are many types of usb-buttons that are preprogrammed to open a website, shutdown the computer and so on. And I have seen some projects using buttons and serial port.
But none of them "have it all", an easy description of how to put togheter the hardware, and an easy description of the code.
I really only need a button connected to the serial port that send some signal that the button has been pressed.
I know this question is a crossover between software and hardware, but when I googled this I have seen plenty more people asking this question, all of them left without answers.
Maybe this question fits stackoverflow?
EDIT: My solution
My application in this case was a que system and I wanted a button for people to print a que ticket.
I just took apart an old ps2-mouse and bought me a button (4$) and solded two wires from the circuit board to the button. Each mouse button has to dots on the back of the circuit board that we can connect an external button to.
Then in my program I just hooked the mousebutton-event systemwide to get when the button is pressed, in my case this computer is dedicated to this program so its not a problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能值得一看 Phidgets:
http://www.phidgets.com/index.php
他们生产许多小型 USB I/O 设备,并且网站上也有代码示例。
Might be worth a look at Phidgets:
http://www.phidgets.com/index.php
They do many little USB I/O devices, and the code samples are there on the site too.
我会看一下 Arduino 微控制器板 - 您可以将各种东西连接到其中(按钮、传感器)并使用 .NET Ports 类与其进行交互。
I would take a look at the Arduino microcontroller board - you can wire all sorts of things into that (buttons, sensors) and interface with it using the .NET Ports classes.
我正在寻找同样的东西。这可能会起作用:
http://awatts.co.uk/
还没有尝试过,但他有运行 shell 命令或模拟按键的代码,如果您需要不同的东西,可以使用源代码。
对于 Linux:在 freshmeat dot net 中搜索 usb-panic-button-daemon 项目。 (我是新用户,不能发布多个超链接!)
我刚刚发现的另一件事是 Griffin 为他们的 PowerMate 提供了一个 SDK(至少他们以前是这样,我正在等待回复)旋钮让它模拟的不仅仅是按键。
顺便说一句,我正在寻找 USB 按钮,但我也可以使用串行按钮,想一想。
I'm looking for the same thing. this might do the trick:
http://awatts.co.uk/
Haven't tried it yet, but he has code to run a shell command or simulate a keypress and the source code is available if you need something different.
And for Linux: search freshmeat dot net for usb-panic-button-daemon project. (I'm a new user, and can't post more than one hyperlink!)
And another thing I just found is that Griffin makes an SDK available (at least they used to, I'm waiting for a reply) for their PowerMate knob to get it to simulate more than mostly just keypresses.
BTW I'm looking for USB buttons, but I could use serial too, come to think of it.