/// <summary> /// Create a new ADXL335 sensor object. /// </summary> /// <param name="x">Analog pin connected to the X axis output from the ADXL335 sensor.</param> /// <param name="y">Analog pin connected to the Y axis output from the ADXL335 sensor.</param> /// <param name="z">Analog pin connected to the Z axis output from the ADXL335 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 ADXL335(IAnalogPin x, IAnalogPin y, IAnalogPin 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); } _x = new AnalogInputPort(x); _y = new AnalogInputPort(y); _z = new AnalogInputPort(z); // // Now set the default calibration data. // XVoltsPerG = 0.325; YVoltsPerG = 0.325; ZVoltsPerG = 0.550; SupplyVoltage = 3.3; if (updateInterval > 0) { StartUpdating(); } else { Update().RunSynchronously(); } }
/// <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(IAnalogPin pin, IAnalogPin referenceVoltagePin) { _sensor = new AnalogInputPort(pin); _referenceVoltagePort = new AnalogInputPort(referenceVoltagePin); }
/// <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(IAnalogPin pin, double referenceVoltage) { _sensor = new AnalogInputPort(pin); _referenceVoltagePort = null; _referenceVoltage = referenceVoltage; }