/// <summary> /// 初始化设备 /// </summary> private void InitDevices() { zigBeeDeivce = new ZigBee(new ZigBeeLibrary.ComSettingModel { ZigbeeCom = "COM29" }); zigBeeDeivce.InitSerialPort(); zigBeeDeivce.Open(); //adamDevices = new ADAM4150(new DigitalLibrary.ComSettingModel { DigitalQuantityCom = "COM19" }); //adamDevices.InitSerialPort(); //adamDevices.Open(); //try //{ // string[] port = SerialPort.GetPortNames(); // if (port.Length <= 0) // { // return; // } adamDevices = new Common.DevicesOperate.ADAM4150("COM4"); adamDevices.Open(); //} //catch (Exception e) //{ // return; //} ledPlayer = new LEDPlayer("COM28"); //ledPlayer.InitSerialPort(); ledPlayer.Open(); }
public MainWindow() { InitializeComponent(); fourAnalogZigbee = new ZigBee(new ComSettingModel { ZigbeeCom = "COM1" }); }
public MainWindow() { InitializeComponent(); comZ = new ZigBeeLibrary.ComSettingModel(); comZ.ZigbeeCom = "COM6"; zigBee = new ZigBee(comZ); zigBee.DataReceivedCallback += ZigBee_DataReceivedCallback; comA = new DigitalLibrary.ComSettingModel(); comA.DigitalQuantityCom = "COM4"; adam = new ADAM4150(comA); seach = new Thread(new ThreadStart(se)); seach.Start(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { zigBee = new ZigBee(new ZigBeeLibrary.ComSettingModel() { ZigbeeCom = "COM4" }); adam = new ADAM4150(new DigitalLibrary.ComSettingModel() { DigitalQuantityCom = "COM5" }); timer.Elapsed += Timer_Elapsed; timer.AutoReset = true; timer.Interval = 1000; timer.Start(); }
private void Dst_Tick(object sender, EventArgs e) { ZigBeeLibrary.ComSettingModel zig = new ZigBeeLibrary.ComSettingModel(); zig.ZigbeeCom = "com3"; DigitalLibrary.ComSettingModel adam = new DigitalLibrary.ComSettingModel(); adam.DigitalQuantityCom = "com2"; ZigBee zigb = new ZigBee(zig); zigb.GetSet(); ADAM4150 ada = new ADAM4150(adam); ada.SetData(); textBox.Text = zigb.temperatureValue; textBox1.Text = zigb.humidityValue; textBox5.Text = zigb.lightValue; textBox2.Text = ada.DI2.ToString(); textBox3.Text = ada.DI1.ToString(); textBox4.Text = ada.DI0.ToString(); textBox6.Text = ada.DI4.ToString(); }