PWM in VB 6.0

beenthere

Joined Apr 20, 2004
15,819
There is more to it than just some code. The LED is a current operated device, and will burn up (and quite possibly take your serial port with it) if current through the LED is not properly controlled.

You have no indication about how you are planning to attach the LED to the port, so worrying about code fragments is getting ahead of yourself.

I might suggest you read and understand our material on LED's - http://www.allaboutcircuits.com/vol_3/chpt_3/12.html

You also need to find what voltages are present out of the COM port, so you can arrange for a properly-sized resistor to control current in the LED. Then you can see about generating code to control the LED with PWM.

Do you have any idea what that code fragment is supposed to do?
 

CDRIVE

Joined Jul 1, 2008
2,219
You're going to need a current limiting resistor for the LED. A 2.2k LED limiting resistor should be a fair ballpark value for a start. Your code needs help though. As it currently stands, your code will throw as many design time and run time errors as you have lines of code! You may also want to consider utilizing the DTR pin instead of the TX pin, as the code to do this will be easier.
 
Top