I got a code online to read via rs232 using serial port ,the code uses readExisting() to get the data(im geting data form a MettlerToledo scale connected at com3,9600,8,N,1)problem no开发者_如何学编程w is that i change it to ReadLine() but it captures the weight once and i need the weight updated all the time! Any ideas?
You could use a loop of some form
While someBoolean
'Read the serial port
End While
I would suggest putting this on a BackGroundWorker as to not interrupt the main thread
Or you could use a Timer
Dim weightTimer As Timer = new Timer(100) 'pick either the threading or the Forms timer depending
'Using the Forms timer for the example
'Handle the timer tick event
Private Sub weightTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles weightTimer.Tick
'Read the Serial Port
End Sub
精彩评论