arduino+vb6

Use this Arduino sketch to upload to your board
DO NOT CHANGE ANYTHING!!!

void setup()
{                
  pinMode(9, OUTPUT); 
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(4, INPUT);
  pinMode(5, INPUT);
  pinMode(7, OUTPUT);
  Serial.begin (9600);
}
void loop()
{

  int a = digitalRead (2);
  int b = digitalRead (3);
  int c = digitalRead (4);
  int d = digitalRead (5); 
  //digitalWrite (7,LOW);
  {
    if (a == HIGH)
    {
      Serial.println("<a>");
      digitalWrite (9, HIGH);
      Serial.println ("Red is the color of Led/ The pressures value is 20psi");
      delay (200);
      digitalWrite (7, HIGH);
      delay (400);
      digitalWrite (7, LOW);

    }
    else if (a == LOW)
    {
      digitalWrite (9, LOW);

    }

    if (b == HIGH)
    {
        Serial.println("<b>");
      digitalWrite (10, HIGH);
      Serial.println ("Green is the color of Led/The pressures value is 40psi");
      delay (200);
      digitalWrite (7, HIGH);
      delay (400);
      digitalWrite (7, LOW);
      delay (200);
      digitalWrite (7, HIGH);
      delay (400);
      digitalWrite (7, LOW);
      
    }
    else if(b==LOW)
    {
      digitalWrite (10, LOW);
     
    }

    if (c == HIGH)
    {
      Serial.println("<c>");
      digitalWrite (11, HIGH);
      Serial.println ("Blue is the color of Led/The pressures value is 60psi");
      delay (200);
      digitalWrite (7, HIGH);
      delay (400);
      digitalWrite (7, LOW);
      delay (200);
      digitalWrite (7, HIGH);
      delay (400);
      digitalWrite (7, LOW);
      delay (200);
      digitalWrite (7, HIGH);
      delay (400);
      digitalWrite (7, LOW);
      
    }
    else if (c==LOW)
    {
      digitalWrite (11, LOW);
     
    }

    if (d == HIGH)
    {
        Serial.println("<d>");
      digitalWrite (12, HIGH);
      Serial.println ("Yellow is the color of Led/The pressures value is 80psi");
      delay (200);
      digitalWrite (7, HIGH);

    }
    else if (d==LOW)
    {
      digitalWrite (12, LOW);
 
    }

  }
}

Create a new project and use the code below you need a put a label called (label1)and caption it "Com Port Number. add a communication object named (MSComm1). Put in a text box called
(ComPort). Add another longer text box called (text1). add a command button called (Command1)change the caption to "find com port". now add another text box called (text1).
Next add a shape object called (Shape1)
compile and run the code. Put the number of the com port into the text box called ComPort... just type in "1". click the command button and the other text box should show the pressure and the shape object should change colors.
If it is the wrong com port you will see the error 8002 comport not found ( or whatever it says)
Then re start and try another port till it doesn't give error messages.
DO NOT CHANGE THE CODE!!!

' Option Explicit
' this is added to allow the sleep call
Private Declare Sub Sleep Lib "kernel32" ( _
    ByVal dwMilliseconds As Long)


Private Sub LEDOn(col As Long)

 Shape1.BackColor = col
End Sub

Private Sub LEDOff()

 Shape1.BackColor = &HFFFFFF
End Sub


Private Sub Command1_Click()
If Val(ComPort) < "1" Then Exit Sub
With MSComm1
        If .PortOpen Then .PortOpen = False
        .CommPort = Val(ComPort)
        .Settings = "9600,N,8,1"
        .DTREnable = True
        .RTSEnable = True
        .RThreshold = 4
        .SThreshold = 3
        .PortOpen = True
  End With
End Sub

Private Sub MSComm1_OnComm()
Dim strData As String
Static strBuffer As String
Dim strWords() As String
Dim intPos As Integer
Dim boComplete As Boolean
Dim mystr As String


 
        Sleep 1000 'this waits one second between readings from the Arduino
        mystr = "" ' set the string to nothing
        mystr = MSComm1.Input
      
   
            intPos = InStr(mystr, "<")
            If intPos > 0 Then
           
                Select Case Mid(mystr, 1, 3) ' strip off the CR/LF
                    Case "<a>"
                        Text1.Text = ("The pressures value is 20 psi")
                        Call LEDOn(vbRed) ' this is in hex
                    Case "<b>"
                        Text1.Text = ("The pressures value is 40 psi")
                        Call LEDOn(vbGreen) ' this is in hex
                    Case "<c>"
                        Text1.Text = ("The pressures value is 60 psi")
                        Call LEDOn(vbBlue) ' this is in hex
                    Case "<d>"
                        Text1.Text = ("The pressures value is 80 psi")
                        Call LEDOn(vbYellow) ' this is in hex
                    Case Else
                       Call LEDOff
                End Select
         End If

End Sub