まずは、C#のWindowsFormとGainerをくっつけることに成功。
Gainerのボタンを押すとボタンが消えるだけのコードですが。
Gainerをつないでgspを実行しといて、WindowsFormを実行
ソースはこんなかんじ。
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 HelloWorld { public partial class HelloForm : Form { private Gainer gio; public HelloForm() { InitializeComponent(); } private void HelloForm_Load(object sender, EventArgs e) { gio = new Gainer("localhost", 2000, Gainer.MODE1, true); gio.onReady += onReady; gio.onPressed += onPressed; gio.onReleased += onReleased; } //gspとの接続成功時に発生 private void onReady() { lblText.Visible = true; } //I/Oモジュールのボタンが押された時に発生 private void onPressed() { lblText.Visible = false; } //I/Oモジュールのボタンが離された時に発生 private void onReleased() { lblText.Visible = true; } } }
さてと、とにかくこれをどうしたらいいんだろう。
COMとかよくわかってない蜜葉にはむずかしい。
とりあえず加速度をWindowsFormでとれるように回路とコードを組んでみるか。