読者です 読者をやめる 読者になる 読者になる

atelier:mitsuba

i love UI/UX, Blend, XAML, Behavior, P5, oF, Web, Tangible Bits and Physical computing. なにかあればお気軽にご連絡ください。atelier@c-mitsuba.com

Silverlight-OOBとGainerを繋ぎたい@その3

Silverlight Gainer

加速度とれたあああああああああああああああああああwwwwww

ぁ、背景はVSですよ。ええ、VSですよww

あとはこれをCOM化すればどうすればいいんだろう・・・

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;
            //timer1.Enabled = true;
        }

        //gspとの接続成功時に発生
        private void onReady()
        {
            //label1.Text = "ain0 ";
            label1.Visible = true;
            label2.Visible = true;
            label3.Visible = true;
            label4.Visible = true;
            timer1.Enabled = true;
        }

        //定期処理
        private void timer1_Tick(object sender, EventArgs e)
        {
            //label1.Text = "ain0 ";
            gio.peekAnalogInput();
            if (gio.analogInput != null)
            {
                label1.Text = "ain0 " + gio.analogInput[0];
                label2.Text = "ain1 " + gio.analogInput[1];
                label3.Text = "ain2 " + gio.analogInput[2];
                label4.Text = "ain3 " + gio.analogInput[3];
            }

        }

    }
}