Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

serial input read gives 10 samples but I only want 1

I have my sensor connected to com1. Here is my code:

Private Sub CWButton1_ValueChanged(ByVal Value As Boolean)

Do While CWButton1.Value = True
Data = CWSerial1.Read
AllData = AllData + Data
TextIn.Text = AllData
CWGraph1.ChartY Val(Data)
DoEvents
Loop

End Sub

My problem is I just want one sample per loop, but I'm getting like 10. I don't know if I can change the output of the sensor. Is there a way to just get one sample at a time?

BTW I'm new with measurement studio, but it is very cool!

thanks,
Brian
0 Kudos
Message 1 of 3
(3,258 Views)
Have you tried using the optional bufferSize parameter to CWSerial.Read? For more info, see the documentation for CWSerial.Read in the Measurement Studio reference.

- Elton
0 Kudos
Message 2 of 3
(3,258 Views)
I had the end of string set to "none", changed it to carriage return and that seemed to fix the problem.

Brian
0 Kudos
Message 3 of 3
(3,258 Views)