This should be all the code necessary to connect to the V1CS and read its data. Do with the data what you like (display, log, etc).
SerialPort serialPort = new SerialPort();
serialPort.BaudRate = 9600;
serialPort.DataBits = 8;
serialPort.Parity = 0;
serialPort.StopBits = StopBits.One;
serialPort.Handshake = Handshake.None;
serialPort.PortName = "COM1";
serialPort.Open();
try
{
serialPort.Write("p"); //Power on the V1Connect
while (serialPort.IsOpen)
{
char[] data = serialPort.ReadTo(" ").ToCharArray();
if (data.Length == 17) //Ensure we read all the bytes
{
int strength = Int32.Parse("" + data[1]);
bool xOn = (data[2] == '1');
bool kOn = (data[3] == '1');
bool kaOn = (data[4] == '1');
bool laserOn = (data[5] == '1');
bool A = (data[6] == '1');
bool B = (data[7] == '1');
bool C = (data[8] == '1');
bool D = (data[9] == '1');
bool E = (data[10] == '1');
bool F = (data[11] == '1');
bool G = (data[12] == '1');
bool dp = (data[13] == '1');
bool frontArrow = (data[14] == '1');
bool sideArrow = (data[15] == '1');
bool rearArrow = (data[16] == '1');
//Display the values
}
}
}
catch (Exception e)
{
}