Beispiel #1
0
        public LightSensor(AnaloguePort port, int deviceAddress, II2CDeviceFactory i2CDeviceFactory, bool normalizeValue = true) : base(port, deviceAddress, i2CDeviceFactory)
        {
            _normalizeValue = normalizeValue;
            var(pin1, _)    = Port.ToPinPair();
            var bus = I2CDeviceFactory.GetOrCreateI2CDevice(deviceAddress);

            _adc = new AnalogueDigitalConverter(bus, pin1);
            AddToDisposables(_adc);
        }
Beispiel #2
0
        public Potentiometer(AnaloguePort port, int deviceAddress, bool normalizeValue = true) : base(port, deviceAddress)
        {
            _normalizeValue = normalizeValue;
            var(pin1, _)    = Port.ToPinPair();
            var bus = PiTopModule.CreateI2CDevice(deviceAddress);

            _adc = new AnalogueDigitalConverter(bus, pin1);

            AddToDisposables(_adc);
        }