Exemplo n.º 1
0
        /// <summary>
        ///     Create a new ADXL337 sensor object.
        /// </summary>
        /// <param name="x">Analog pin connected to the X axis output from the ADXL377 sensor.</param>
        /// <param name="y">Analog pin connected to the Y axis output from the ADXL377 sensor.</param>
        /// <param name="z">Analog pin connected to the Z axis output from the ADXL377 sensor.</param>
        /// <param name="updateInterval">Update interval for the sensor, set to 0 to put the sensor in polling mode.</param>
        /// <<param name="accelerationChangeNotificationThreshold">Acceleration change threshold.</param>
        public Adxl377(IIODevice device, IPin x, IPin y, IPin z, ushort updateInterval = 100,
                       double accelerationChangeNotificationThreshold = 0.1F)
        {
            if ((updateInterval != 0) && (updateInterval < MinimumPollingPeriod))
            {
                throw new ArgumentOutOfRangeException(nameof(updateInterval),
                                                      "Update interval should be 0 or greater than " + MinimumPollingPeriod);
            }

            _xPort = device.CreateAnalogInputPort(x);
            _yPort = device.CreateAnalogInputPort(y);
            _zPort = device.CreateAnalogInputPort(z);
            //
            //  Now set the default calibration data.
            //
            XVoltsPerG    = 0.00825;
            YVoltsPerG    = 0.00825;
            ZVoltsPerG    = 0.00825;
            SupplyVoltage = 3.3;

            if (updateInterval > 0)
            {
                var t = StartUpdating();
            }
            else
            {
                Update().RunSynchronously();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Create a new ADXL337 sensor object.
 /// </summary>
 /// <param name="xPin">Analog pin connected to the X axis output from the ADXL337 sensor.</param>
 /// <param name="yPin">Analog pin connected to the Y axis output from the ADXL337 sensor.</param>
 /// <param name="zPin">Analog pin connected to the Z axis output from the ADXL337 sensor.</param>
 public Adxl337(IIODevice device, IPin xPin, IPin yPin, IPin zPin)
 {
     _xPort = device.CreateAnalogInputPort(xPin);
     _yPort = device.CreateAnalogInputPort(yPin);
     _zPort = device.CreateAnalogInputPort(zPin);
     //
     //  Now set the default calibration data.
     //
     XVoltsPerG    = 0.325f;
     YVoltsPerG    = 0.325f;
     ZVoltsPerG    = 0.550f;
     SupplyVoltage = 3.3f;
 }
Exemplo n.º 3
0
 /// <summary>
 ///     New instance of the AnalogWaterLevel class.
 /// </summary>
 /// <param name="analogPin">Analog pin the temperature sensor is connected to.</param>
 /// <param name="sensorType">Type of sensor attached to the analog port.</param>
 /// <param name="calibration">Calibration for the analog temperature sensor. Only used if sensorType is set to Custom.</param>
 public AnalogWaterLevel(
     IIODevice device,
     IPin analogPin,
     Calibration calibration = null
     ) : this(device.CreateAnalogInputPort(analogPin), calibration)
 {
 }
Exemplo n.º 4
0
 /// <summary>
 ///     New instance of the AnalogTemperatureSensor class.
 /// </summary>
 /// <param name="analogPin">Analog pin the temperature sensor is connected to.</param>
 /// <param name="sensorType">Type of sensor attached to the analog port.</param>
 /// <param name="calibration">Calibration for the analog temperature sensor.</param>
 public AnalogTemperature(
     IIODevice device,
     IPin analogPin,
     KnownSensorType sensorType,
     Calibration calibration = null
     ) : this(device.CreateAnalogInputPort(analogPin), sensorType, calibration)
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a Capacitive soil moisture sensor object with the specified analog pin and a IO device.
 /// </summary>
 /// <param name="device"></param>
 /// <param name="analogPin"></param>
 public Capacitive(
     IIODevice device,
     IPin analogPin,
     float minimumVoltageCalibration = 0f,
     float maximumVoltageCalibration = 3.3f) :
     this(device.CreateAnalogInputPort(analogPin), minimumVoltageCalibration, maximumVoltageCalibration)
 {
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a FC28 soil moisture sensor object with the especified analog pin, digital pin and IO device.
 /// </summary>
 /// <param name="analogPort"></param>
 /// <param name="digitalPort"></param>
 public Fc28(
     IIODevice device,
     IPin analogPin,
     IPin digitalPin,
     float minimumVoltageCalibration = 0f,
     float maximumVoltageCalibration = 3.3f) :
     this(device.CreateAnalogInputPort(analogPin), device.CreateDigitalOutputPort(digitalPin), minimumVoltageCalibration, maximumVoltageCalibration)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a new `WindVane` on the specified IO Device's analog input.
 /// Optionally, with a custom voltage to azimuth lookup.
 /// </summary>
 /// <param name="device">The IO Device.</param>
 /// <param name="analogInputPin">The analog input pin.</param>
 /// <param name="azimuthVoltages">Optional. Supply if you have custom azimuth voltages.</param>
 public WindVane(IIODevice device, IPin analogInputPin, IDictionary <float, Azimuth> azimuthVoltages = null)
     : this(device.CreateAnalogInputPort(analogInputPin), azimuthVoltages)
 {
 }
Exemplo n.º 8
0
 public Gp2D12(IIODevice device, IPin analogInputPin)
 {
     analogInputPort          = device.CreateAnalogInputPort(analogInputPin);
     analogInputPort.Changed += AnalogInputPort_Changed;
 }
Exemplo n.º 9
0
 /// <summary>
 ///     Create a new light sensor object using a static reference voltage.
 /// </summary>
 /// <param name="pin">AnalogChannel connected to the sensor.</param>
 public Temt6000(IIODevice device, IPin pin)
 {
     sensor = device.CreateAnalogInputPort(pin);
 }
Exemplo n.º 10
0
 /// <summary>
 ///     Create a new light sensor object using a dynaic reference voltage.
 /// </summary>
 /// <param name="pin">Analog channel connected to the sensor.</param>
 /// <param name="referenceVoltagePin">Analog channel connected to the reference voltage souce.</param>
 public ALSPT19315C(IIODevice device, IPin pin, IPin referenceVoltagePin)
 {
     _sensor = device.CreateAnalogInputPort(pin);
     _referenceVoltagePort = device.CreateAnalogInputPort(referenceVoltagePin);
 }
Exemplo n.º 11
0
 public Ky038(IIODevice device, IPin A0, IPin D0) :
     this(device.CreateAnalogInputPort(A0), device.CreateDigitalInputPort(D0))
 {
 }
Exemplo n.º 12
0
 public TMP36(IIODevice device, IPin pin)
 {
     analogPort = device.CreateAnalogInputPort(pin);
 }
Exemplo n.º 13
0
 public AnalogJoystick(IIODevice device, IPin horizontalPin, IPin verticalPin, JoystickCalibration calibration = null, bool isInverted = false) :
     this(device.CreateAnalogInputPort(horizontalPin), device.CreateAnalogInputPort(verticalPin), calibration, isInverted)
 {
 }
Exemplo n.º 14
0
 public CapacitiveTouchScreen(IIODevice device, IPin pinXPos, IPin pinXNeg, IPin pinYPos, IPin pinYNeg)
 {
     portXNeg = device.CreateAnalogInputPort(pinXNeg);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Creates a FC28 soil moisture sensor object with the especified analog pin, digital pin and IO device.
 /// </summary>
 /// <param name="analogPort"></param>
 /// <param name="digitalPort"></param>
 public FC28(IIODevice device, IPin analogPin, IPin digitalPin) :
     this(device.CreateAnalogInputPort(analogPin), device.CreateDigitalOutputPort(digitalPin))
 {
 }
Exemplo n.º 16
0
 /// <summary>
 /// Creates a Capacitive soil moisture sensor object with the especified analog pin and a IO device.
 /// </summary>
 /// <param name="device"></param>
 /// <param name="analogPin"></param>
 public Capacitive(IIODevice device, IPin analogPin) :
     this(device.CreateAnalogInputPort(analogPin))
 {
 }
Exemplo n.º 17
0
 /// <summary>
 ///     Create a new light sensor object using a static reference voltage.
 /// </summary>
 /// <param name="pin">AnalogChannel connected to the sensor.</param>
 public Alspt19315C(IIODevice device, IPin pin)
 {
     sensor = device.CreateAnalogInputPort(pin);
 }
Exemplo n.º 18
0
 public AnalogJoystick(IIODevice device, IPin horizontalPin, IPin verticalPin, JoystickCalibration calibration = null) :
     this(device.CreateAnalogInputPort(horizontalPin), device.CreateAnalogInputPort(verticalPin), calibration)
 {
 }
Exemplo n.º 19
0
 /// <summary>
 ///     Create a new light sensor object using a static reference voltage.
 /// </summary>
 /// <param name="pin">AnalogChannel connected to the sensor.</param>
 /// <param name="referenceVoltage">Reference voltage.</param>
 public ALSPT19315C(IIODevice device, IPin pin, double referenceVoltage)
 {
     _sensor = device.CreateAnalogInputPort(pin);
     _referenceVoltagePort = null;
     _referenceVoltage     = referenceVoltage;
 }