Pulse the USB port using C++

Send data/5v through the usb data connection using c++

Page 1 of 1

4 Replies - 8069 Views - Last Post: 31 December 2010 - 07:38 AM Rate Topic: -----

#1 macb6497  Icon User is offline

  • D.I.C Head

Reputation: -6
  • View blog
  • Posts: 80
  • Joined: 25-December 09

Pulse the USB port using C++

Posted 31 December 2010 - 05:46 AM

Hello,

I'm trying to control a motor.

I don't want to use a commutator because of the high level of friction and low precision.

I don't want to use a reed switch or hall effect sensor because of their slight opposing forces. (The magnets or coils of the switch/sensor will slightly attract the magnets of my motor.

Because of that I want to simply use my computer to control the motor.

I'm using a NPN Darlington set transistor which will be hooked up to a battery on its collector and emitter and connected to the computer on its base.

I simply wanted to know how a could send a quick 5 volts/data packet to the base of the transistor to activate the circuit?

I have created the program as a whole, now I'm just looking for the "cout << USBPORT".

What libraries and output function will I need?

Thanks,

Is This A Good Question/Topic? 0
  • +

Replies To: Pulse the USB port using C++

#2 macb6497  Icon User is offline

  • D.I.C Head

Reputation: -6
  • View blog
  • Posts: 80
  • Joined: 25-December 09

Re: Pulse the USB port using C++

Posted 31 December 2010 - 06:09 AM

better yet, how would I simply turn the USB port on and off?

How long would it take to do that?

Is it near instant or is it like a program, files/libraries have to be loaded?
Was This Post Helpful? 0
  • +
  • -

#3 Korupt  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 21
  • View blog
  • Posts: 185
  • Joined: 22-June 08

Re: Pulse the USB port using C++

Posted 31 December 2010 - 06:39 AM

Look up some tutorials for libusb: http://libusb.org/
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6064
  • View blog
  • Posts: 23,520
  • Joined: 23-August 08

Re: Pulse the USB port using C++

Posted 31 December 2010 - 07:33 AM

We have one great one by Anarion right here, as a matter of fact.
Was This Post Helpful? 0
  • +
  • -

#5 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 291
  • View blog
  • Posts: 1,900
  • Joined: 25-October 06

Re: Pulse the USB port using C++

Posted 31 December 2010 - 07:38 AM

View Postmacb6497, on 31 December 2010 - 12:09 PM, said:

better yet, how would I simply turn the USB port on and off?

How long would it take to do that?

Is it near instant or is it like a program, files/libraries have to be loaded?

alternativly you could use the parallel port or serial port
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1