Here is a snippet of code on the serial port side of things:
MSComm.Settings = "9600,s,8,1"
MSComm.PortOpen = True
If MSComm.PortOpen <> True Then MsgBox "Port failed to open"
If Not MSComm.DSRHolding Then ' data set ready low (car power is off), shut down PC when timeout occurs
shutdownCtr = shutdownCtr + 1
shutdownStatus = playing
WinAmpPause
If shutdownCtr >= 5 Then
Shutdown EWX_SHUTDOWN 'shut down the computer
shutdownCtr = 0 'clear counter so we don't shutdown again
End If
End If
|