Public Class AInForm
Private gio As Gainer
'ロード時の初期化
Private Sub AInForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
gio = New Gainer("localhost", 2000, Gainer.MODE1, True)
gio.onReady = AddressOf onReady
End Sub
'gspとの接続成功時に発生
Private Sub onReady()
lblAIn0.Visible = True
lblAIn1.Visible = True
lblAIn2.Visible = True
lblAIn3.Visible = True
timInput.Enabled = True
End Sub
'定期処理
Private Sub timInput_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timInput.Tick
gio.peekAnalogInput()
If gio.analogInput IsNot Nothing Then
lblAIn0.Text = "ain0 " + gio.analogInput(0).ToString()
lblAIn1.Text = "ain1 " + gio.analogInput(1).ToString()
lblAIn2.Text = "ain2 " + gio.analogInput(2).ToString()
lblAIn3.Text = "ain3 " + gio.analogInput(3).ToString()
End If
End Sub
End Class
|