Esempio n. 1
0
 public IGoPiGo BuildGoPiGo()
 {
     if (_device == null)
     {
         _device = new GoPiGo();
     }
     return(_device);
 }
Esempio n. 2
0
        private GoPiGo BuildGoPiGoImpl(int goPiGoAddress)
        {
            if (_device != null)
            {
                return(_device);
            }

            /* Initialize the I2C bus */
            var settings = new I2cConnectionSettings(goPiGoAddress)
            {
                BusSpeed = I2cBusSpeed.StandardMode
            };

            _device = Task.Run(async() =>
            {
                var dis = await GetDeviceInfo();
                // Create an I2cDevice with our selected bus controller and I2C settings
                var device = await I2cDevice.FromIdAsync(dis[0].Id, settings);
                return(new GoPiGo(device));
            }).Result;
            return(_device);
        }
 public EncoderController(GoPiGo goPiGo)
 {
     _goPiGo = goPiGo;
 }