Public Class DOutForm
Private gio As Gainer
Private doutValue(3) As Boolean 'デジタル出力値
'コンストラクタ
Private Sub DOutForm_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()
cbDOut0.Enabled = True
cbDOut1.Enabled = True
cbDOut2.Enabled = True
cbDOut3.Enabled = True
End Sub
'dout0チェック変更のイベント処理
Private Sub cbDOut0_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbDOut0.CheckedChanged
doutValue(0) = cbDOut0.Checked
gio.digitalOutput(doutValue)
End Sub
'dout1チェック変更のイベント処理
Private Sub cbDOut1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbDOut1.CheckedChanged
doutValue(1) = cbDOut1.Checked
gio.digitalOutput(doutValue)
End Sub
'dout2チェック変更のイベント処理
Private Sub cbDOut2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbDOut2.CheckedChanged
doutValue(2) = cbDOut2.Checked
gio.digitalOutput(doutValue)
End Sub
'dout3チェック変更のイベント処理
Private Sub cbDOut3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbDOut3.CheckedChanged
doutValue(3) = cbDOut3.Checked
gio.digitalOutput(doutValue)
End Sub
End Class
|