Reputation: 483
I want to write code in C language to switch on/off an electric bulb via USB port. USB port gives 5 volts, so I want that bulb can take power from computer's USB port.
Is it possible?
Upvotes: 0
Views: 1317
Reputation: 561
Using USB for this task is a bit complicated, the common way is to use some (ftdi) usb to serial converter. To switch a light bulb or motor you need a micro controller on the other side of the usb cable.
In fact, an arduino-pcb has an build in usb to serial converter, so you can use an arduino to switch something on/off by using an usb port.
How to read/write a serial port depends on your operating system, but there a lot of examples for each operating system
Upvotes: 2
Reputation: 1539
It seems that there's no easy way to directly switch the power of USB ports. At least, on a normal PC. So you will need some kind of relay.
Upvotes: 0