tkbx
tkbx

Reputation: 16305

Controlling electronic components with USB?

I want to try something that I imagine is somewhat simple. I want to have a USB cable with an LED on it, and a python script that would have 2 possible arguments: "on" and "off". This would toggle the LED on and off (obviously). So, anyone who knows software know which libraries (if not libusb) to use and how to use them, and hardware people, know how I might make said circuit? I don't want to turn the USB's power supply off, I just want to change something in the circuit to disable the LED.

Upvotes: 1

Views: 2880

Answers (1)

Hugh Bothwell
Hugh Bothwell

Reputation: 56694

USB is a serial protocol; you can't just set it "on" or "off", the way you used to be able to set a parallel port pin.

You need something (ie an embedded microprocessor) on the far end; the computer talks to the microprocessor which drives the LED.

Take a look at an Arduino; they are cheap, readily available, and easy to use.

Edit: try the Teensy - completely Arduino-compatible, $16, just over an inch square, has a USB port and 25 I/O pins.

Upvotes: 3

Related Questions