问题
我在开关量的数据采集的时候出值不是那么的准
这里面的光照的值出的是电压值需要乘330除32768
代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using NLE.Device.ZigBee;
namespace zigbee
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
ZigBeeSeries zigbee = new ZigBeeSeries ("COM2");
public MainWindow ()
{
InitializeComponent ();
}
private void button_Click (object sender, RoutedEventArgs e)
{
zigbee.Connect ();
zigbee.DataReceived += Zigbee_DataReceived;
}
private void Zigbee_DataReceived (object sender, ZigBeeDataEventArgs e)
{
if (e.Data.Type == SensorType.Fire) { //fire是火焰的值,sensortype是一个供你选择的变量
textBlock.Text = e.Data.Value1.ToString(); //将他存在value1里面就可以了
}
}
}
}