hi.
You may have missed out a piece of code.
It should be like this, make sure you have all the 'components' on the form
Option Explicit
Private Sub cmdSend_Click()
Dim PinNumber As Long
Dim PinState As Long
' Get Pin Number
PinNumber = cboPinNumber.ListIndex
' Get Pin State
If optState(0).Value = True Then
PinState = 0
Else
PinState = 1
End If
' Send Out Data
MSComm1.Output = Chr$(255) & Chr$(PinNumber) & Chr$(PinState)
End Sub
Private Sub Form_Load()
Dim Pins As Long
' Add the pin numbers 0 to 15 to cboPinNumber
For Pins = 0 To 15
cboPinNumber.AddItem CStr(Pins)
Next Pins
' Default to Pin 0 being selected
cboPinNumber.ListIndex = 0
' Default to optState(0) being selected
optState(0).Value = True
' Use COM1
MSComm1.CommPort = 1
' 2400 baud, no parity, 8 data bits, 1 stop bit
MSComm1.Settings = "2400,N,8,1"
' Make sure DTR line is low to prevent Stamp reset
MSComm1.DTREnable = False
' Open the port
MSComm1.PortOpen = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub