如何将命令从C#发送到硬件板。 [英] How to send Command from C# to hardware board.
问题描述
我正在使用c#设计用户界面。我通过usb通信将我的硬件套件连接到PC,我从用户界面(PC)发送一些命令以从硬件获取数据。
我成功发送命令并从硬件接收响应。 />
我发送的命令如下
Hi,
I am designing user interface using c#. I have connected my hardware kit to PC via usb communication and i am sending some commands from user interface(PC) to get data from hardware.
I am successfully sending commands and receiving response from hardware.
I am sending the command like this
SendCommand("TEMP");
我试图从用户界面发送Esc按钮命令。我的意思是我想像这样发送
I am trying to send "Esc" button command from user interface. I mean i want to send like this
SendCommand("27");
但不起作用。我认为ESC(字符27)按钮。
有谁能建议我如何发送?
but not working. I think ESC (character 27) button.
Can anyone suggest me how to send that?
推荐答案
假设SendCommand是您自己的方法,它只接受一个字符串:
Assuming that SendCommand is your own method, and it only accepts a string:
SendCommand("\x1b");
应该发送一个转义字符。
Should send a single escape character.
我不熟悉这个东西的类型。但我觉得这很有趣。你可以参考这些链接。如果您修改某些内容会很有帮助。
通过串口发送ENTER键 [ ^ ]
按下退出键按下应用程序 [ ^ ]
按Escape键调用方法 [ ^ ]
虚拟密钥代码 [ ^ ]
问候..:)
I am not familiar with this type of stuff. But i found this interesting.You can refer to these links. It would be helpful if you modify something.
Sending "ENTER" key through serial port[^]
Close Application at Press of Escape Button[^]
Press Escape key to call method[^]
Virtual-Key Codes[^]
Regards.. :)
这篇关于如何将命令从C#发送到硬件板。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!