コード例 #1
0
        public ATReading TakeMeasurement()
        {
            var reading = new ATReading();

            switch (CurrentSensorKind)
            {
            case TemperatureSensor.BME280:
                Int32  temp;
                UInt32 hum, press;
                BME280ReadPressureTmeperatureHumidity(out press, out temp, out hum);
                reading.Temperature = (double)temp / 100.0;
                reading.Pressure    = (double)press / 100;
                reading.Humidity    = (double)hum / 1024;

                break;

            case TemperatureSensor.TMP102:
                reading.Temperature = TakeMeasurementTemp102();
                break;
            }
            //    var accelReading= ReadI2CAccel();
            //  reading.AccelX = accelReading.X;
            //    reading.AccelY = accelReading.Y;
            //  reading.AccelZ = accelReading.Z;

            return(reading);
        }
コード例 #2
0
ファイル: Sensor.cs プロジェクト: ms-iotkithol-jp/IoTKitHoLV3
        public ATReading TakeMeasurement()
        {
            var reading = new ATReading();
            switch (CurrentSensorKind)
            {
                case TemperatureSensor.BME280:
                    Int32 temp;
                    UInt32 hum, press;
                    BME280ReadPressureTmeperatureHumidity(out press, out temp, out hum);
                    reading.Temperature = (double)temp / 100.0;
                    double pressure = (double)press / 100;
                    double humidity = (double)hum / 1024;
                    break;
                case TemperatureSensor.TMP102:
                    reading.Temperature = TakeMeasurementTemp102();
                    break;
            }
            var accelReading= ReadI2CAccel();
            reading.AccelX = accelReading.X;
            reading.AccelY = accelReading.Y;
            reading.AccelZ = accelReading.Z;

            return reading;
        }