public static void Run()
        {
            var scope = new DebugScope();
            //scope.UpdatePeriod.Value = 1;

            var accel = new Memsic2125();

            accel.XPwmInput.ConnectTo(new DigitalInputPin(Pins.GPIO_PIN_D6).Output);
            accel.YPwmInput.ConnectTo(new DigitalInputPin(Pins.GPIO_PIN_D7).Output);
            scope.ConnectTo(accel.XAccelerationOutput);
            scope.ConnectTo(accel.YAccelerationOutput);

            var compass = new Grove3AxisDigitalCompass();

            scope.ConnectTo(compass.XGaussOutput);
            scope.ConnectTo(compass.YGaussOutput);
            scope.ConnectTo(compass.ZGaussOutput);

            var a0 = new AnalogInputPin(AnalogChannels.ANALOG_PIN_A0);

            scope.ConnectTo(a0.Analog);

            var sharp = new SharpGP2D12();

            a0.Analog.ConnectTo(sharp.AnalogInput);
            scope.ConnectTo(sharp.DistanceOutput);

            var therm = new Thermistor();

            therm.AnalogInput.ConnectTo(a0.Analog);
            scope.ConnectTo(therm.Temperature);

            var b = new CelsiusToFahrenheit();

            therm.Temperature.ConnectTo(b.Celsius);
            scope.ConnectTo(b.Fahrenheit);


            var bmp = new Bmp085();

            scope.ConnectTo(bmp.Temperature);

            var b2 = new CelsiusToFahrenheit();

            bmp.Temperature.ConnectTo(b2.Celsius);
            scope.ConnectTo(b2.Fahrenheit);


            for (; ;)
            {
                Debug.Print("Tick");
                Thread.Sleep(1000);
            }
        }
Esempio n. 2
0
        internal static byte GetRelativeThermistorByte(Sensor.BaseSensorDevice sensor, IThermistor thermistor)
        {
            if (thermistor == null)
            {
                return(0);
            }
            if (!(thermistor is Thermistor))
            {
                return(7);
            }
            Thermistor thermistorCast = (Thermistor)thermistor;

            return((byte)((sensor.device == thermistorCast.device) ? thermistorCast.id : 7));
        }
Esempio n. 3
0
        /// <summary>
        /// 设置comboBox的默认索引
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox_boardNum.SelectedIndex = 0;
            SampleRateCombo.SelectedIndex   = 7;
            stripChart_position.YAutoEnable = false;
            stripChart_position.AxisYMax    = 10;
            stripChart_position.AxisYMin    = 0;

            stripChart_weight.YAutoEnable = true;
            this._loadCell           = new LoadCell(1.5, 1000, 5);
            this._displacementsensor = new DisplacementSensor(5000, 10, 0);
            this._thermistor         = new Thermistor(100000, 3950);
            //stripChart_weight.AxisYMax = 1000;
            //stripChart_weight.AxisYMin = 0;
        }
Esempio n. 4
0
        private void easyButton1_Click(object sender, EventArgs e)
        {
            value = (double)numericUpDown_value.Value;
            for (int i = 0; i < values.Length; i++)
            {
                values[i] = value;
            }
            double[] res;

            switch (comboBox1.SelectedItem.ToString())
            {
            case "位移传感器":
                numericUpDown_result.Value = (decimal)DisplacementSensor.Convert(value, (double)numericUpDown_maxDisp.Value, (double)numericUpDown_maxR.Value, (double)numericUpDown_minR.Value);
                res = DisplacementSensor.Convert(values, (double)numericUpDown_maxDisp.Value, (double)numericUpDown_maxR.Value, (double)numericUpDown_minR.Value);
                easyChartX1.Plot(res);
                break;

            case "荷重传感器":
                numericUpDown_result.Value = (decimal)LoadCell.Convert(value, (double)numericUpDown_sensitivity.Value, (double)numericUpDown_maxLoad.Value, (double)numericUpDown_excitationVolt.Value);
                res = LoadCell.Convert(values, (double)numericUpDown_sensitivity.Value, (double)numericUpDown_maxLoad.Value, (double)numericUpDown_excitationVolt.Value);
                easyChartX1.Plot(res);
                break;

            case "热电阻RTD_PT100":
                numericUpDown_result.Value = (decimal)RTD.Convert(value);
                res = RTD.Convert(values);
                easyChartX1.Plot(res);
                break;

            case "热敏电阻Thermistor":
                numericUpDown_result.Value = (decimal)Thermistor.Convert(value, (double)numericUpDown_resistorRT.Value, (double)numericUpDown_beta.Value);
                res = Thermistor.Convert(values, (double)numericUpDown_resistorRT.Value, (double)numericUpDown_beta.Value);
                easyChartX1.Plot(res);
                break;

            case "热电偶Thermocouple":
                numericUpDown_result.Value = (decimal)Thermocouple.Convert((ThermocoupleType)Enum.Parse(typeof(ThermocoupleType), comboBox2.Text), value, checkBox_cjcEnable.Checked, (double)numericUpDown_cjcTemperature.Value);
                res = Thermocouple.Convert((ThermocoupleType)Enum.Parse(typeof(ThermocoupleType), comboBox2.Text), values, checkBox_cjcEnable.Checked, (double)numericUpDown_cjcTemperature.Value);
                easyChartX1.Plot(res);
                break;

            default:
                break;
            }
        }
Esempio n. 5
0
        public static void Main()
        {
            // Try to get clock at system start
            try
            {
                var time = NtpClient.GetNetworkTime();
                Utility.SetLocalTime(time);
            }
            catch (Exception ex)
            {
                // Don't depend on time
                Debug.Print("Error setting clock: " + ex.Message);
            }

            var led = new OutputPort(Pins.ONBOARD_LED, false);
            var pin0 = new AnalogInput(Pins.GPIO_PIN_A0);
            var pin1 = new AnalogInput(Pins.GPIO_PIN_A1);

            var state = new StateContainer();
            var light = new Photocell(pin0);
            var temp = new Thermistor(pin1);
            //var weather = new Weather(48638);
            var netlisten = new NetListener(state, 5348);

            netlisten.Start();

            while (true)
            {
                led.Write(true);

                state.LightValue = light.Read();
                state.Temperature = temp.Fahrenheit;

                //Logger.WriteLine(state.GetCSV());

                Thread.Sleep(500);

                led.Write(false);

                Thread.Sleep(10000);
            }
        }
Esempio n. 6
0
 public BalancedMode(Thermistor thermistor)
     : base(thermistor)
 {
 }
Esempio n. 7
0
 public BaseCurve(Thermistor thermistor) : base(thermistor)
 {
     LoadDefaultCurve();
 }
Esempio n. 8
0
 public PerformanceMode(Thermistor thermistor)
     : base(thermistor)
 {
 }
Esempio n. 9
0
 public QuiteMode(Thermistor thermistor)
     : base(thermistor)
 {
 }
Esempio n. 10
0
 public Default(Thermistor thermistor)
     : base(thermistor)
 {
 }
Esempio n. 11
0
 public CustomCurve(Thermistor thermistor)
     : base(thermistor)
 {
 }