Search code examples
raspberry-piaccelerometeri2cwindows-10-iot-coregyroscope

Windows 10 IoT - DeviceInformation.FindAllAsync() returns empty collection


I'm trying to use a MPU-6050 (GY-521) sensor with my Raspberry Pi 3 and Windows 10 IoT. I'm following this example on Hackster, but the following line

DeviceInformationCollection collection = await DeviceInformation.FindAllAsync(aqs);

returns an empty collection. I am using Microsoft Lightning provider.

This is the aqs string value which is obtained via I2cDevice.GetDeviceSelector() :

System.Devices.InterfaceClassGuid:="{A11EE3C6-8421-4202-A3E7-B91FF90188E4}" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True

Solution

  • DMAP and the inbox drivers are mutually exclusive. The default (inbox) I2C as well as the SPI and GPIO drivers are disabled when DMAP driver is enabled through the device portal.So, the code above in your post will not work. Please use following code instead.

            if (LightningProvider.IsLightningEnabled)
            {
                LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();
            }
    
            I2cController controller = await I2cController.GetDefaultAsync();