コード例 #1
0
        private void buttonOpen_Click(object sender, EventArgs e)
        {
            // Open HID Device
            device = new OaktreeLab.USBDevice.HIDSimple();
//            if ( device.Open( 0x04d8, 0x003f ) ) {
            if (device.Open(0x04D8, 0x0628))
            {
                // Opened the target USB device

                // Set our screen button states
                buttonOpen.Enabled   = false;
                buttonLEDOn.Enabled  = true;
                buttonLEDOff.Enabled = true;
                // Timer Activation
                timer          = new Timer();
                timer.Interval = 100;
                timer.Tick    += new EventHandler(timer_Tick);
                timer.Start();
            }
            else
            {
                // Open failed - device not found
                MessageBox.Show("Device not found");
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: yamamaya/HIDSimpleFramework
        private void buttonOpen_Click( object sender, EventArgs e )
        {
            // HIDデバイスをオープンする
            device = new OaktreeLab.USBDevice.HIDSimple();
            if ( device.Open( 0x04d8, 0x003f ) ) {
                // オープン成功
                // ボタンを切り替え
                buttonOpen.Enabled = false;
                buttonLEDOn.Enabled = true;
                buttonLEDOff.Enabled = true;
                // タイマー起動
                timer = new Timer();
                timer.Interval = 100;
                timer.Tick += new EventHandler( timer_Tick );
                timer.Start();

            } else {
                // オープン失敗(デバイスが見つからない)
                MessageBox.Show( "デバイスが見つかりません" );
            }
        }
コード例 #3
0
 private void buttonOpen_Click(object sender, EventArgs e)
 {
     // HIDデバイスをオープンする
     device = new OaktreeLab.USBDevice.HIDSimple();
     if (device.Open(0x04d8, 0x003f))
     {
         // オープン成功
         // ボタンを切り替え
         buttonOpen.Enabled   = false;
         buttonLEDOn.Enabled  = true;
         buttonLEDOff.Enabled = true;
         // タイマー起動
         timer          = new Timer();
         timer.Interval = 100;
         timer.Tick    += new EventHandler(timer_Tick);
         timer.Start();
     }
     else
     {
         // オープン失敗(デバイスが見つからない)
         MessageBox.Show("デバイスが見つかりません");
     }
 }