private void btnOpen(object sender, RoutedEventArgs e) { if (MPUSB.OpenMPUSBDevice() == 0) { txtVersie.Text = "Connected"; } else if (MPUSB.OpenMPUSBDevice() == -1) { txtVersie.Text = "Connection failed"; return; } DispatcherTimer UITimer = new DispatcherTimer(); UITimer.Interval = TimeSpan.FromMilliseconds(100); UITimer.Tick += UITimer_Tick; UITimer.IsEnabled = true; DispatcherTimer ButtonTimer = new DispatcherTimer(); ButtonTimer.Interval = TimeSpan.FromMilliseconds(100); ButtonTimer.Tick += ButtonTimer_Tick; ButtonTimer.IsEnabled = true; DispatcherTimer InputBTimer = new DispatcherTimer(); InputBTimer.Interval = TimeSpan.FromMilliseconds(1); InputBTimer.Tick += InputBTimer_Tick; InputBTimer.IsEnabled = true; }
public MainWindow() { InitializeComponent(); CheckBox[] leds = new CheckBox[8]; leds[0] = chk1; leds[1] = chk2; leds[2] = chk3; leds[3] = chk4; leds[4] = chk5; leds[5] = chk6; leds[6] = chk7; leds[7] = chk8; ledControl = new LedControlLayer(leds); MPUSB.OpenMPUSBDevice(); timer.AutoReset = true; timer.Interval = 200; timer.Elapsed += timer_Elapsed; timer.Start(); BackgroundWorker bg = new BackgroundWorker(); bg.DoWork += bg_DoWork; bg.RunWorkerAsync(); timer.AutoReset = true; timer.Interval = 1; timer.Elapsed += timerNew_Elapsed; timer.Start(); }
private void btnInit_Click(object sender, RoutedEventArgs e) { MPUSB.OpenMPUSBDevice(); if (rad8bit.IsChecked == true) { WriteLCD(0x38, true); //Function set, 8b, 2L, 5x7 -> 0011 1000 } else { WriteLCD(0x28, true); //Function set, 4b, 2L, 5x7 -> 0010 1000 } WriteLCD(0x02, true); //Cursor home WriteLCD(0x0F, true); //Display on, blink }
public MainWindow() { InitializeComponent(); MPUSB.OpenMPUSBDevice(); bw.WorkerSupportsCancellation = true; bw.WorkerReportsProgress = true; bw.DoWork += Bw_DoWork; bw.ProgressChanged += Bw_ProgressChanged; bw.RunWorkerAsync(); pgbIngang1.Value = Convert.ToInt16(MPUSB.ReadAnalogIn(1)); pgbIngang2.Value = Convert.ToInt16(MPUSB.ReadAnalogIn(0)); }
public MainWindow() { InitializeComponent(); MPUSB.OpenMPUSBDevice(); }
public MainWindow() { InitializeComponent(); MPUSB.OpenMPUSBDevice(); SetStatus("Opened connection to data acquisiton board."); }
private void btnOpen_Click(object sender, RoutedEventArgs e) { MPUSB.OpenMPUSBDevice(); }