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 button1_Click(object sender, RoutedEventArgs e) { DigitalLibrary.ComSettingModel csm = new DigitalLibrary.ComSettingModel(); csm.DigitalQuantityCom = "com2"; ADAM4150 adam = new ADAM4150(csm); if (button1.Tag.ToString() == "1") { adam.OnOff(ADAM4150FuncID.OffDO0); button1.Tag = "0"; } else { adam.OnOff(ADAM4150FuncID.OnDO0); button1.Tag = "1"; } }
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(); }