使用C或任何编程语言的USB端口上控制电源 [英] Controlling voltage supply on usb port using c or any programming language
问题描述
我没有电子多konwledge。我想打开使用程序/关LED连接到USB端口。 USB端口由4号线(数据+线,数据,电压,接地),如果我接电压和接地线,以引导,它会发光。我一直在寻找互联网这个问题上,我发现这是不可能控制LED连接使用USB方案的供应,因为在datapin太低不能被用来囤关LED。
I don't have much konwledge in electronics. i wanted to turn on/off led connected to usb port using program. usb port consists 4 line (data+,data-,voltage ,ground) if i connect voltage and ground lines to led , it will glow. i've been searching on internet this issue and i find that it is not possible to control led connected to usb using program because supply over datapin is too low which can not be used to tun on off led.
但是,如果我连我导致了体积和接地引脚和控制usb口的整个电源,我猜它是什么,可以使用程序来控制LED。有一种方法来禁用和启用了USB接口供电。
but what if i connect my led to vol and ground pin and control the entire power supply of usb port , i guess it is possible to control led using program. there is a way to disable and enable power supply over usb port.
我也想知道它是坏的效仿这种做法。它损坏USB控制器经常启用/禁用电源。
i also want to know is it bad to follow this approach. does it damage usb controller to frequently enable/disable power supply.
Algo :
a = Get_input_from_user() ;
if(a=="ON")
turn power supply of usb port ON.
else
turn power supply of usb port OFF.
这件事肯定是可以使用额外的硬件,我不希望使用任何额外的硬件。
this thing is certainly possible using extra hardwares, i don't want to use any extra hardware.
推荐答案
您可以使用任何基本的Arduino板要做到这一点有一个完整的 IDE 免费的样本code 会做你想做的开箱即用
you can use any basic Arduino board to do this there is a complete IDE free and a LOT of sample code that will do what you want out of the box
您也可以使用COOL板。
you can also use a COOL board.
的Arduino兼容code可用于Teensy
Arduino Compatible code is available for the Teensy
软件开发工具这里
这篇关于使用C或任何编程语言的USB端口上控制电源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!