Things used in this project


Heart bb


Visual Studio Coding - Im using VS 2015 private async void InGpioPinOnValueChanged(GpioPin sender, C#
Add Microsoft Azure Device Client from Nuget and Windows IoT extension
Please forgive I'm not using the best practice for coding...
using Windows.Devices.Gpio;
using Windows.Devices.I2c;
using System.Diagnostics;
using System.Threading.Tasks;
using Windows.UI.Core;
using Windows.Devices.Enumeration;
using Microsoft.Azure.Devices;
using System.Text;
using Microsoft.Azure.Devices.Client;
// Inside MainPage Class
private GpioPin _inGpioPin;

private I2cDevice _converter;

 protected override async void OnNavigatedTo(NavigationEventArgs e)

            await InitializeAsync();

  private async void InGpioPinOnValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
            var bytearray = new byte[2];
            _converter.WriteRead(new byte[] { 0x0 }, bytearray);
            if (BitConverter.IsLittleEndian)
            var value = BitConverter.ToInt16(bytearray, 0);
            // Sending Data to Azure
                        DeviceClient deviceClient = DeviceClient.CreateFromConnectionString("your connection key", TransportType.Http1);
            var msg = new Message(Encoding.UTF8.GetBytes(text));

            await deviceClient.SendEventAsync(value);

        private async Task InitializeAsync()
            var i2CSettings = new I2cConnectionSettings(0x48)
                BusSpeed = I2cBusSpeed.FastMode,
                SharingMode = I2cSharingMode.Shared
            var i2C1 = I2cDevice.GetDeviceSelector("I2C1");
            var devices = await DeviceInformation.FindAllAsync(i2C1);
            _converter = await I2cDevice.FromIdAsync(devices[0].Id, i2CSettings);
            _converter.Write(new byte[] { 0x01, 0xc4, 0xe0 });
            _converter.Write(new byte[] { 0x02, 0x00, 0x00 });
            _converter.Write(new byte[] { 0x03, 0xff, 0xff });
            var gpio = GpioController.GetDefault();
            _inGpioPin = gpio.OpenPin(27);
            _inGpioPin.ValueChanged += InGpioPinOnValueChanged;
  How to Read Data from ADS1115 inspired on the code from  : Oliver Matias MVP


10417750 497130140438825 3057134494897945853 n
Christiano Faig
2 projects • 42 followers


Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback


Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog