using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DInEx {
public partial class DInForm : Form{
private Gainer gio;
//コンストラクタ
public DInForm() {
InitializeComponent();
}
//ロード時の初期化
private void DInForm_Load(object sender, EventArgs e) {
gio=new Gainer("localhost",2000,Gainer.MODE1,true);
gio.onReady+=onReady;
}
//gspとの接続成功時に発生
private void onReady() {
lblDIn0.Visible=true;
lblDIn1.Visible=true;
lblDIn2.Visible=true;
lblDIn3.Visible=true;
timInput.Enabled=true;
}
//定期処理
private void timInput_Tick(object sender, EventArgs e) {
gio.peekDigitalInput();
if (gio.digitalInput!=null) {
lblDIn0.Text="din0 "+gio.digitalInput[0];
lblDIn1.Text="din1 "+gio.digitalInput[1];
lblDIn2.Text="din2 "+gio.digitalInput[2];
lblDIn3.Text="din3 "+gio.digitalInput[3];
}
}
}
}
|