public LEDBackpack Add(int16_t width, int16_t height, Nusbio nusbio, NusbioGpio sdaOutPin, NusbioGpio sclPin, byte addr)
 {
     var b = new LEDBackpack(width, height, nusbio, sdaOutPin, sclPin);
     if (b.Detect(addr)) { 
         b.Begin(addr);
         this._backpacks.Add(b);
         return b;
     }
     else return null;
 }
Beispiel #2
0
        public LEDBackpack Add(int16_t width, int16_t height, byte addr)
        {
            var b = new LEDBackpack(width, height);

            if (b.Detect(addr))
            {
                b.Begin(addr);
                this._backpacks.Add(b);
                return(b);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        public LEDBackpack Add(int16_t width, int16_t height, Nusbio nusbio, NusbioGpio sdaOutPin, NusbioGpio sclPin, byte addr)
        {
            var b = new LEDBackpack(width, height, nusbio, sdaOutPin, sclPin);

            if (b.Detect(addr))
            {
                b.Begin(addr);
                this._backpacks.Add(b);
                return(b);
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        public LEDBackpack Add(I2CDevice_FTDI i2c, int16_t width, int16_t height, int addr)
        {
            var b = new LEDBackpack(i2c, width, height);

            if (b.Detect((byte)addr))
            {
                b.Begin(addr);
                this._backpacks.Add(b);
                return(b);
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
        public static bool InitLEDMatrixes(Nusbio nusbio)
        {
            // Use the Nusbio's Adafruit I2C Adapter to plug up to 2 Adafruit LED Matrix
            // into Nusbio. You can also use a bread board.

            var clockPin           = NusbioGpio.Gpio0; // White
            var dataOutPin         = NusbioGpio.Gpio1; // Green

            // The first Led matrix must have the default I2C id which is 0x70
            // The second one if plugged must have the is 0x71 (A0 Shorted)
            // Or change the I2C Id

            // BackPack address A0, A1, A2, (Carefull the label are inversed)
            // None soldered    = 0x70
            // A0 Shorted       = 0x70 + 1 = 0x71
            // A2 Shorted       = 0x70 + 2 = 0x72
            // A3 Shorted       = 0x70 + 4 = 0x74
            // A0+A1 Shorted    = 0x70 + 2 + 1 = 0x73
            // A0+A2 Shorted    = 0x70 + 4 + 1 = 0x75

            _multiLEDBackpackManager = new MultiLEDBackpackManager();
            _multiLEDBackpackManager.Clear();

            const byte LED_MATRIX_00_I2C_ADDR = 0x70;
            _ledMatrix00 = ConsoleEx.WaitOnComponentToBePlugged<LEDBackpack>("LED Matrix", () => {
                    return _multiLEDBackpackManager.Add(8, 8, nusbio, dataOutPin, clockPin, LED_MATRIX_00_I2C_ADDR);
            });
            if(_ledMatrix00 == null)
                return false;

            const byte LED_MATRIX_01_I2C_ADDR = 0x71;
            _ledMatrix01 = _multiLEDBackpackManager.Add(8, 8, nusbio, dataOutPin, clockPin, LED_MATRIX_01_I2C_ADDR);

            const byte LED_MATRIX_02_I2C_ADDR = 0x72;
            _ledMatrix02 = _multiLEDBackpackManager.Add(8, 8, nusbio, dataOutPin, clockPin, LED_MATRIX_02_I2C_ADDR);

            const byte LED_MATRIX_03_I2C_ADDR = 0x73;
            _ledMatrix03 = _multiLEDBackpackManager.Add(8, 8, nusbio, dataOutPin, clockPin, LED_MATRIX_03_I2C_ADDR);
            
            SetDefaultOrientations();
            SetBrightnesses();

            return true;
        }