0

I have a usb cable and I would like to connect it to my computer, then connect it to my circuit and then a program that I made will run and somehow control the circuit. I have done some research about USB pinouts but I don't know how can I make a program that is installed in my computer and control my circuit that is connected to my computer using a USB cable.

NOTE: I know basic programming and basic electronics :)

EDIT IN THE QUESTION: The program on my computer will send bytes through the circuit using a USB cable. Then my circuit will interpret this bytes and do something.

Opal
  • 81,889
  • 28
  • 189
  • 210
Miguel Lorenzo
  • 560
  • 1
  • 5
  • 12
  • 1
    The program on the PC send bytes over the USB cable, the "circuit" reads these bytes and interprets them. This way you can send *messages* between the units, and each message can tell the "circuit" to do something special. You can't, however, control the actual physical pins, and neither should you try, that's the purpose of the USB controller hardware. If the "circuit" doesn't have a dedicated USB controller hardware, then you can still handle by programming the data-pins, but it requires *much* more knowledge than just "basic programming and basic electronics". – Some programmer dude May 04 '15 at 15:49
  • http://playground.arduino.cc/interfacing/python – Ôrel May 04 '15 at 15:51
  • @JoachimPileborg yes that's what I want to happen, gonna edit my question thanks. Can you give me an example or how to do it?? – Miguel Lorenzo May 04 '15 at 15:57
  • 2
    @MiguelLorenzo No I can't, because it depends on your hardware. And I don't know the timings needed for driving the signals. Trust me, you need more than "basic" knowledge of both programming and the USB signaling to be able to do it. Do get some dedicated hardware controller to handle it, it will be much easier in the long run. – Some programmer dude May 04 '15 at 16:06
  • ^^ I'll second this. [this](http://www.usb.org/developers/docs/usb20_docs/usb_20_031815.zip) is a link to the USB2.0 specification. It's a 56MB PDF. – marko May 10 '15 at 20:17

1 Answers1

0

You cannot just connect a USB cable to your circuit like it's a GPIO pin. You must have some sort of USB device at the end of the cable. Anything else and you risk frying your computer.

If you have an Arduino, for example, you connect the cable to the arduino USB port, and the Arduino appears on your computer as a COM port (Windows) or a serial port (Linux etc). You set the serial port speed and options, and then you can communicate with the Arduino.

http://www.arduino.cc/en/Reference/Serial

Jamie
  • 1,888
  • 1
  • 18
  • 21