You didn't say what VS language so I'll assume VB
If Not SerialPort1.IsOpen() Then
SerialPort1.Open()
End If
SerialPort1.Write(5)
Arduino
if (Serial.available () > 0) {
pin = Serial.read();
digitalWrite (pin, HIGH);
}
That's the basic idea, but there's a lot of extra "stuff" required to make it reliable.
Rob