how to create a code.. for the voltage contrl...

Dani AI

Generated

Brief practical answer (builds on , and ): there are two realistic routes to switch LEDs from VB.

  1. Parallel port (old PCs): the classic LPT has 8 data lines (D0–D7) you can toggle, but modern Windows prevents direct port IO from user apps without a helper driver/DLL. Never drive LEDs directly from the port pins — use current‑limiting resistors and a driver/buffer (transistor array like ULN200x or MOSFETs) so the PC is not damaged.

  2. USB (recommended today): easiest for beginners is a USB microcontroller (Arduino or similar) that presents a virtual COM port. VB talks to the COM port; the microcontroller toggles the outputs and drives LEDs safely. This avoids kernel drivers and works on any modern PC.

Minimal VB.NET pattern to send simple on/off commands over serial (Arduino listens for "1"/"0"):

Imports System.IO.Ports

Dim sp As New SerialPort("COM3", 9600)

Sub OpenPort()
    If Not sp.IsOpen Then sp.Open()
End Sub

Sub SetLed(state As Boolean)
    If sp.IsOpen Then
        If state Then sp.Write("1") Else sp.Write("0")
    End If
End Sub

Practical tips and scaling

  • For many LEDs use a shift register (74HC595), port expanders (MCP23008/MCP23017), or LED drivers (MAX7219).
  • Always use series resistors and a separate supply for large LED arrays; share ground with the PC.
  • If you need direct USB bit control (no microcontroller firmware), look at USB GPIO ICs (FTDI/MCP2221 families) or HID/WinUSB approaches — those require using vendor APIs or Windows APIs from VB.
  • For serial examples see the .NET SerialPort docs and for a beginner-friendly hardware path see the Arduino getting‑started guide:
    SerialPort Class
    Arduino Guide

This complements the parallel/USB discussion above: for a beginner wanting quick results, USB + Arduino is fastest and safest; parallel is doable only on systems with an LPT port and proper buffering.

Recommended Answers

All 7 Replies

voltage control??

Hello there xcard14, what is a Voltage Control is it a System or Program, etc.? It will greatly help us if you explain more..


Kenneth

sorry guyz for unclear message...
voltage control.... rather using pc interfacing / parallel port / printer port using VB...
i want to know how may LED can function turn on/off using VB what is the exact code/command... "sorry no background in VB"

this for accessing parallel port :

http://www.aaroncake.net/electronics/vblpt.htm

actually i never tried to control led before, but you can see this following link :

http://ashishrd.blogspot.com/2006/11/controlling-leds-with-parallel-port.html --> this is a good one

commented: thanks for the links +1
commented: Helpfull links +1
commented: wow +1
commented: thanks... +1

thank you very much... im sure its useful....

Thank all...
voltage control.... using pc interfacing / USB port / using VB...
i want to know how may LED can function turn on/off using VB what is the exact code/command... "sorry no background in VB"

USB interface in Visual Basic

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.