Esempio n. 1
0
        /// <summary>
        /// Create a shift register with the appropriate Pi pins
        /// </summary>
        /// <param name="signalPin">GPIO Pin connected to Pin 14 of the SN74HC595N</param>
        /// <param name="signalClockPin">GPIO Pin connected to Pin 11 of the SN74HC595N</param>
        /// <param name="registerClockPin">GPIO Pin connected to Pin 12 of the SN74HC595N</param>
        /// <param name="clearPin">GPIO Pin connected to Pin 10 of the SN74HC595N</param>
        /// <param name="outputEnabledPin">GPIO Pin connected to Pin 13 of the SN74HC595N</param>
        /// <param name="numChips">The number of SN74HC595N connected in series.</param>
        /// To connect multiple chips in series connect
        /// Pi                  Chip 1      Chip 2      Chip 3
        /// signalPin           -> Pin 14
        /// signalClockPin      -> Pin 11   -> Pin 11   -> Pin 11
        /// registerClockPin    -> Pin 12   -> Pin 12   -> Pin 12
        /// clearPin            -> Pin 10   -> Pin 10   -> Pin 10
        /// outputEnabledPin    -> Pin 13   -> Pin 13   -> Pin 13
        ///                        Pin 9    -> Pin 14
        ///                                    Pin 9    -> Pin 14
        public ShiftRegister(PreparedPin signalPin, PreparedPin signalClockPin, PreparedPin registerClockPin, PreparedPin clearPin, PreparedPin outputEnabledPin,
                             int numChips = 1)
        {
            _signalPin        = signalPin;
            _signalClockPin   = signalClockPin;
            _registerClockPin = registerClockPin;
            clearPin.On(); // make sure the clear pin is pulled high
            _outputEnabledPin = outputEnabledPin;

            _values = new bool[numChips * 8];

            SendAllValues();
        }
Esempio n. 2
0
 public I2C(PreparedPin sdaPin, PreparedPin sclPin)
 {
     _sda = sdaPin;
     _scl = sclPin;
 }