Ali Uysal
Published

Real-time Pin monitoring Windows IOT

Real time monitoring of IOT pin status - Windows IOT.

BeginnerShowcase (no instructions)2 hours2,740
Real-time Pin monitoring Windows IOT

Things used in this project

Story

Read more

Code

Real time monitoring of IOT pin status - Windows IOT

C#
VS 2015
using System;
using Windows.Devices.Gpio;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Core;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace App12
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            InitializeComponent();
            InitGPIO();

        }
        private void InitGPIO()
        {
            var gpio = GpioController.GetDefault();

            // GPIO denetleyici yoksa hata uyar gster
            if (gpio == null)
            {
                GpioStatus.Text = "Denetleyici Yok";
                GpioStatus.Foreground = redBrush;
                return;
            }

            // GPIO Pinleri a
       //     GPIO02pin = gpio.OpenPin(GPIO02);
       //     GPIO03pin = gpio.OpenPin(GPIO03);
            GPIO04pin = gpio.OpenPin(GPIO04);
            GPIO05pin = gpio.OpenPin(GPIO05);
            GPIO06pin = gpio.OpenPin(GPIO06);
      //      GPIO07pin = gpio.OpenPin(GPIO07);
      //      GPIO08pin = gpio.OpenPin(GPIO08);
      //      GPIO09pin = gpio.OpenPin(GPIO09);
      //      GPIO10pin = gpio.OpenPin(GPIO10);
     //       GPIO11pin = gpio.OpenPin(GPIO11);
            GPIO12pin = gpio.OpenPin(GPIO12);
            GPIO13pin = gpio.OpenPin(GPIO13);
     //       GPIO14pin = gpio.OpenPin(GPIO14);
     //       GPIO15pin = gpio.OpenPin(GPIO15);
            GPIO16pin = gpio.OpenPin(GPIO16);
            GPIO17pin = gpio.OpenPin(GPIO17);
            GPIO18pin = gpio.OpenPin(GPIO18);
            GPIO19pin = gpio.OpenPin(GPIO19);
            GPIO20pin = gpio.OpenPin(GPIO20);
            GPIO21pin = gpio.OpenPin(GPIO21);
            GPIO22pin = gpio.OpenPin(GPIO22);
            GPIO23pin = gpio.OpenPin(GPIO23);
            GPIO24pin = gpio.OpenPin(GPIO24);
            GPIO25pin = gpio.OpenPin(GPIO25);
            GPIO26pin = gpio.OpenPin(GPIO26);
            GPIO27pin = gpio.OpenPin(GPIO27);



// GPIO02 PULL CONTROL
 //           if (GPIO02pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
 //               GPIO02pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
 //           else
 //               GPIO02pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
  //          GPIO02pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
   //         GPIO02pin.ValueChanged += GPIO02_ValueChanged;

            //  




// GPIO03 PULL CONTROL
 //           if (GPIO03pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
  //              GPIO03pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
  //          else
   //             GPIO03pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
   //         GPIO03pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
   //         GPIO03pin.ValueChanged += GPIO03_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";




// GPIO04 PULL CONTROL
            if (GPIO04pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO04pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO04pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO04pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO04pin.ValueChanged += GPIO04_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO05 PULL CONTROL
            if (GPIO05pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO05pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO05pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO05pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO05pin.ValueChanged += GPIO05_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";

            

// GPIO06 PULL CONTROL
            if (GPIO06pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO06pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO06pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO06pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO06pin.ValueChanged += GPIO06_ValueChanged;

            //       GpioStatus.Text = "GPIO hatasz balatld";




// GPIO07 PULL CONTROL
   //         if (GPIO07pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
   //             GPIO07pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
   //         else
    //            GPIO07pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
   //         GPIO07pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
   //         GPIO07pin.ValueChanged += GPIO07_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";




// GPIO08 PULL CONTROL
 //           if (GPIO08pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
 //               GPIO08pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
  //          else
 //               GPIO08pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
 //           GPIO08pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
  //          GPIO08pin.ValueChanged += GPIO08_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";




// GPIO09 PULL CONTROL
  //          if (GPIO09pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
  //              GPIO09pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
  //          else
  //              GPIO09pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
  //          GPIO09pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
 //           GPIO09pin.ValueChanged += GPIO09_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO10 PULL CONTROL
  //          if (GPIO10pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
  //              GPIO10pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
 //           else
 //               GPIO10pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
  //          GPIO10pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
  //          GPIO10pin.ValueChanged += GPIO10_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";




// GPIO11 PULL CONTROL
   //         if (GPIO11pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
  //              GPIO11pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
   //         else
  //              GPIO11pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
  //          GPIO11pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
   //         GPIO11pin.ValueChanged += GPIO11_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";



        

// GPIO12 PULL CONTROL
            if (GPIO12pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO12pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO12pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO12pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO12pin.ValueChanged += GPIO12_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO13 PULL CONTROL
            if (GPIO13pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO13pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO13pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO13pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO13pin.ValueChanged += GPIO13_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";
       



// GPIO14 PULL CONTROL
     //       if (GPIO14pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
     //           GPIO14pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
     //       else
     //           GPIO14pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
     //       GPIO14pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
      //      GPIO14pin.ValueChanged += GPIO14_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";




// GPIO15 PULL CONTROL
    //        if (GPIO15pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
    //            GPIO15pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
    //        else
    //            GPIO15pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
    //        GPIO15pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
    //        GPIO15pin.ValueChanged += GPIO15_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";




// GPIO16 PULL CONTROL
            if (GPIO16pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO16pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO16pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO16pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO16pin.ValueChanged += GPIO16_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO17 PULL CONTROL
            if (GPIO17pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO17pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO17pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO17pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO17pin.ValueChanged += GPIO17_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";




// GPIO18 PULL CONTROL
            if (GPIO18pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO18pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO18pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO18pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO18pin.ValueChanged += GPIO18_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO19 PULL CONTROL
            if (GPIO19pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO19pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO19pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO19pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO19pin.ValueChanged += GPIO19_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO20 PULL CONTROL
            if (GPIO20pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO20pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO20pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO20pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO20pin.ValueChanged += GPIO20_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO21 PULL CONTROL
            if (GPIO21pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO21pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO21pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO21pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO21pin.ValueChanged += GPIO21_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO22 PULL CONTROL
            if (GPIO22pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO22pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO22pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO22pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO22pin.ValueChanged += GPIO22_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO23 PULL CONTROL
            if (GPIO23pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO23pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO23pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO23pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO23pin.ValueChanged += GPIO23_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO24 PULL CONTROL
            if (GPIO24pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO24pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO24pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO24pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO24pin.ValueChanged += GPIO24_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO25 PULL CONTROL
            if (GPIO25pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO25pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO25pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO25pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO25pin.ValueChanged += GPIO25_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO26 PULL CONTROL
            if (GPIO26pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO26pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO26pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO26pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO26pin.ValueChanged += GPIO26_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";





// GPIO27 PULL CONTROL
            if (GPIO27pin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                GPIO27pin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                GPIO27pin.SetDriveMode(GpioPinDriveMode.Input);

            // Butona basldnda grlty filitrelemek iin zaman am ayarla
            GPIO27pin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            GPIO27pin.ValueChanged += GPIO27_ValueChanged;

            //  GpioStatus.Text = "GPIO hatasz balatld";



        }


        //     private void GPIO02_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        //      {
        // toggle the state of the LED every time the button is pressed
        //         if (e.Edge == GpioPinEdge.FallingEdge)
        //         {
        //    PinValue = (PinValue == GpioPinValue.Low) ?
        //   GpioPinValue.High : GpioPinValue.Low;
        //   GPIO02pin.Write(PinValue);

        //}

        // need to invoke UI updates on the UI thread because this event
        // handler gets invoked on a separate thread.
        //     var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
        //      if (e.Edge == GpioPinEdge.FallingEdge)

        //     {
        //      PinValue = GpioPinValue.Low;
        //     OGPIO02.Fill = redBrush;
        //     Gpio02Status.Text = "ekiliyor";
        //   }
        //      else
        //     {
        //     OGPIO02.Fill = grayBrush;
        //    Gpio02Status.Text = "Bota";
        //    }
        //    });
        //    }


        //    private void GPIO03_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        //   {
        //        // toggle the state of the LED every time the button is pressed
        //       if (e.Edge == GpioPinEdge.FallingEdge)
        //        {
        //    PinValue = (PinValue == GpioPinValue.Low) ?
        //   GpioPinValue.High : GpioPinValue.Low;
        //  GPIO03pin.Write(PinValue);

        // }

        // need to invoke UI updates on the UI thread because this event
        // handler gets invoked on a separate thread.
        //   var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
        //           if (e.Edge == GpioPinEdge.FallingEdge)

        //          {
        //  PinValue = GpioPinValue.Low;
        // OGPIO03.Fill = redBrush;
        // Gpio03Status.Text = "ekiliyor";
        //}
        //         else
        //        {
        // OGPIO03.Fill = grayBrush;
        // Gpio03Status.Text = "Bota";
        // }
        //   });
        //  }


        private void GPIO04_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        {
            // toggle the state of the LED every time the button is pressed
            if (e.Edge == GpioPinEdge.FallingEdge)
            {
                PinValue = (PinValue == GpioPinValue.Low) ?
                    GpioPinValue.High : GpioPinValue.Low;
                GPIO04pin.Write(PinValue);

            }

            // need to invoke UI updates on the UI thread because this event
            // handler gets invoked on a separate thread.
            var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                if (e.Edge == GpioPinEdge.FallingEdge)

                {
                    PinValue = GpioPinValue.Low;
                    OGPIO04.Fill = redBrush;
                    Gpio04Status.Text = "ekiliyor";
                }
                else
                {
                    OGPIO04.Fill = grayBrush;
                    Gpio04Status.Text = "Bota";
                }
            });
        }


        private void GPIO05_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        {
            // toggle the state of the LED every time the button is pressed
            if (e.Edge == GpioPinEdge.FallingEdge)
            {
                PinValue = (PinValue == GpioPinValue.Low) ?
                    GpioPinValue.High : GpioPinValue.Low;
                GPIO05pin.Write(PinValue);

            }

            // need to invoke UI updates on the UI thread because this event
            // handler gets invoked on a separate thread.
            var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                if (e.Edge == GpioPinEdge.FallingEdge)

                {
                    PinValue = GpioPinValue.Low;
                    OGPIO05.Fill = redBrush;
                    Gpio05Status.Text = "ekiliyor";
                }
                else
                {
                    OGPIO05.Fill = grayBrush;
                    Gpio05Status.Text = "Bota";
                }
            });
        }



        private void GPIO06_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        {
            // toggle the state of the LED every time the button is pressed
            if (e.Edge == GpioPinEdge.FallingEdge)
            {
                PinValue = (PinValue == GpioPinValue.Low) ?
                    GpioPinValue.High : GpioPinValue.Low;
                GPIO06pin.Write(PinValue);

            }

            // need to invoke UI updates on the UI thread because this event
            // handler gets invoked on a separate thread.
            var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                if (e.Edge == GpioPinEdge.FallingEdge)

                {
                    PinValue = GpioPinValue.Low;
                    OGPIO06.Fill = redBrush;
                    Gpio06Status.Text = "ekiliyor";
                }
                else
                {
                    OGPIO06.Fill = grayBrush;
                    Gpio06Status.Text = "Bota";
                }
            });
        }


        //   private void GPIO07_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        //    {
        // toggle the state of the LED every time the button is pressed
        //        if (e.Edge == GpioPinEdge.FallingEdge)
        //      {
        //PinValue = (PinValue == GpioPinValue.Low) ?
        //GpioPinValue.High : GpioPinValue.Low;
        //GPIO07pin.Write(PinValue);

        //}

        // need to invoke UI updates on the UI thread because this event
        // handler gets invoked on a separate thread.
        //        var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
        //              if (e.Edge == GpioPinEdge.FallingEdge)

        //            {
        //PinValue = GpioPinValue.Low;
        //  OGPIO07.Fill = redBrush;
        //    Gpio07Status.Text = "ekiliyor";
        //  }
        //           else
        //          {
        //  OGPIO07.Fill = grayBrush;
        //  Gpio07Status.Text = "Bota";
        // }
        //   });
        //  }



        //    private void GPIO08_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        //     {
        // toggle the state of the LED every time the button is pressed
        //         if (e.Edge == GpioPinEdge.FallingEdge)
        //         {
        //     PinValue = (PinValue == GpioPinValue.Low) ?
        //  GpioPinValue.High : GpioPinValue.Low;
        //  GPIO08pin.Write(PinValue);

        // }

        // need to invoke UI updates on the UI thread because this event
        // handler gets invoked on a separate thread.
        //  var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
        //          if (e.Edge == GpioPinEdge.FallingEdge)

        //         {
        // PinValue = GpioPinValue.Low;
        // OGPIO08.Fill = redBrush;
        //  Gpio08Status.Text = "ekiliyor";
        //}
        //      else
        //      {
        // OGPIO08.Fill = grayBrush;
        //  Gpio08Status.Text = "Bota";
        // }
        // });
        // }


        //private void GPIO09_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        //{
        //    // toggle the state of the LED every time the button is pressed
        //    if (e.Edge == GpioPinEdge.FallingEdge)
        //    {
        //        PinValue = (PinValue == GpioPinValue.Low) ?
        //            GpioPinValue.High : GpioPinValue.Low;
        //        GPIO09pin.Write(PinValue);

        //    }

        //    // need to invoke UI updates on the UI thread because this event
        //    // handler gets invoked on a separate thread.
        //    var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
        //        if (e.Edge == GpioPinEdge.FallingEdge)

        //        {
        //            PinValue = GpioPinValue.Low;
        //            OGPIO09.Fill = redBrush;
        //            Gpio09Status.Text = "ekiliyor";
        //        }
        //        else
        //        {
        //            OGPIO09.Fill = grayBrush;
        //            Gpio09Status.Text = "Bota";
        //        }
        //    });
        //}



        //private void GPIO10_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        //{
        //    // toggle the state of the LED every time the button is pressed
        //    if (e.Edge == GpioPinEdge.FallingEdge)
        //    {
        //        PinValue = (PinValue == GpioPinValue.Low) ?
        //            GpioPinValue.High : GpioPinValue.Low;
        //        GPIO10pin.Write(PinValue);

        //    }

        //    // need to invoke UI updates on the UI thread because this event
        //    // handler gets invoked on a separate thread.
        //    var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
        //        if (e.Edge == GpioPinEdge.FallingEdge)

        //        {
        //            PinValue = GpioPinValue.Low;
        //            OGPIO10.Fill = redBrush;
        //            Gpio10Status.Text = "ekiliyor";
        //        }
        //        else
        //        {
        //            OGPIO10.Fill = grayBrush;
        //            Gpio10Status.Text = "Bota";
        //        }
        //    });
        //}



        //private void GPIO11_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        //{
        //    // toggle the state of the LED every time the button is pressed
        //    if (e.Edge == GpioPinEdge.FallingEdge)
        //    {
        //        PinValue = (PinValue == GpioPinValue.Low) ?
        //            GpioPinValue.High : GpioPinValue.Low;
        //        GPIO11pin.Write(PinValue);

        //    }

        //    // need to invoke UI updates on the UI thread because this event
        //    // handler gets invoked on a separate thread.
        //    var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
        //        if (e.Edge == GpioPinEdge.FallingEdge)

        //        {
        //            PinValue = GpioPinValue.Low;
        //            OGPIO11.Fill = redBrush;
        //            Gpio11Status.Text = "ekiliyor";
        //        }
        //        else
        //        {
        //            OGPIO11.Fill = grayBrush;
        //            Gpio11Status.Text = "Bota";
        //        }
        //    });
        //}



        private void GPIO12_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        {
            // toggle the state of the LED every time the button is pressed
            if (e.Edge == GpioPinEdge.FallingEdge)
            {
                PinValue = (PinValue == GpioPinValue.Low) ?
                    GpioPinValue.High : GpioPinValue.Low;
                GPIO12pin.Write(PinValue);

            }

            // need to invoke UI updates on the UI thread because this event
            // handler gets invoked on a separate thread.
            var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                if (e.Edge == GpioPinEdge.FallingEdge)

                {
                    PinValue = GpioPinValue.Low;
                    OGPIO12.Fill = redBrush;
                    Gpio12Status.Text = "ekiliyor";
                }
                else
                {
                    OGPIO12.Fill = grayBrush;
                    Gpio12Status.Text = "Bota";
                }
            });
        }


        private void GPIO13_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        {
            // toggle the state of the LED every time the button is pressed
            if (e.Edge == GpioPinEdge.FallingEdge)
            {
                PinValue = (PinValue == GpioPinValue.Low) ?
                    GpioPinValue.High : GpioPinValue.Low;
                GPIO13pin.Write(PinValue);

            }

            // need to invoke UI updates on the UI thread because this event
            // handler gets invoked on a separate thread.
            var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                if (e.Edge == GpioPinEdge.FallingEdge)

                {
                    PinValue = GpioPinValue.Low;
                    OGPIO13.Fill = redBrush;
                    Gpio13Status.Text = "ekiliyor";
                }
                else
                {
                    OGPIO13.Fill = grayBrush;
                    Gpio13Status.Text = "Bota";
                }
            });
        }


        //private void GPIO14_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        //{
        //    // toggle the state of the LED every time the button is pressed
        //    if (e.Edge == GpioPinEdge.FallingEdge)
        //    {
        //        PinValue = (PinValue == GpioPinValue.Low) ?
        //            GpioPinValue.High : GpioPinValue.Low;
        //        GPIO14pin.Write(PinValue);

        //    }

        //    // need to invoke UI updates on the UI thread because this event
        //    // handler gets invoked on a separate thread.
        //    var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
        //        if (e.Edge == GpioPinEdge.FallingEdge)

        //        {
        //            PinValue = GpioPinValue.Low;
        //            OGPIO14.Fill = redBrush;
        //            Gpio14Status.Text = "ekiliyor";
        //        }
        //        else
        //        {
        //            OGPIO14.Fill = grayBrush;
        //            Gpio14Status.Text = "Bota";
        //        }
        //    });
        //}



        //private void GPIO15_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        //{
        //    // toggle the state of the LED every time the button is pressed
        //    if (e.Edge == GpioPinEdge.FallingEdge)
        //    {
        //        PinValue = (PinValue == GpioPinValue.Low) ?
        //            GpioPinValue.High : GpioPinValue.Low;
        //        GPIO15pin.Write(PinValue);

        //    }

        //    // need to invoke UI updates on the UI thread because this event
        //    // handler gets invoked on a separate thread.
        //    var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
        //        if (e.Edge == GpioPinEdge.FallingEdge)

        //        {
        //            PinValue = GpioPinValue.Low;
        //            OGPIO15.Fill = redBrush;
        //            Gpio15Status.Text = "ekiliyor";
        //        }
        //        else
        //        {
        //            OGPIO15.Fill = grayBrush;
        //            Gpio15Status.Text = "Bota";
        //        }
        //    });
        //}



        private void GPIO16_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        {
            // toggle the state of the LED every time the button is pressed
            if (e.Edge == GpioPinEdge.FallingEdge)
            {
                PinValue = (PinValue == GpioPinValue.Low) ?
                    GpioPinValue.High : GpioPinValue.Low;
                GPIO16pin.Write(PinValue);

            }

            // need to invoke UI updates on the UI thread because this event
            // handler gets invoked on a separate thread.
            var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                if (e.Edge == GpioPinEdge.FallingEdge)

                {
                    PinValue = GpioPinValue.Low;
                    OGPIO16.Fill = redBrush;
                    Gpio16Status.Text = "ekiliyor";
                }
                else
                {
                    OGPIO16.Fill = grayBrush;
                    Gpio16Status.Text = "Bota";
                }
            });
        }


        private void GPIO17_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        {
            // toggle the state of the LED every time the button is pressed
            if (e.Edge == GpioPinEdge.FallingEdge)
            {
                PinValue = (PinValue == GpioPinValue.Low) ?
                    GpioPinValue.High : GpioPinValue.Low;
                GPIO17pin.Write(PinValue);

            }

            // need to invoke UI updates on the UI thread because this event
            // handler gets invoked on a separate thread.
            var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                if (e.Edge == GpioPinEdge.FallingEdge)

                {
                    PinValue = GpioPinValue.Low;
                    OGPIO17.Fill = redBrush;
                    Gpio17Status.Text = "ekiliyor";
                }
                else
                {
...

This file has been truncated, please download it to see its full contents.

Credits

Ali Uysal

Ali Uysal

1 project • 2 followers

Comments