开发者

Capture weight of a Mettler Toledo truck Scale using serialport

开发者 https://www.devze.com 2023-04-01 06:20 出处:网络
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开发者_如何学编程

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
0

精彩评论

暂无评论...
验证码 换一张
取 消