Blinkled Lighting The first LED light (C #)

Source: Internet
Author: User
Tags blank page

Interface:

<StackPanelHorizontalAlignment= "Center"VerticalAlignment= "Center">            <TextBoxName= "InfoText"Text= "Ready"FontSize= " the"HorizontalAlignment= "Center"VerticalAlignment= "Center"></TextBox>            <ButtonName= "Submitaction"FontSize= " the"HorizontalAlignment= "Center"VerticalAlignment= "Center"Click= "Submitaction_click">Exit</Button>        </StackPanel>

Code:

usingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Linq;usingSystem.Runtime.InteropServices.WindowsRuntime;usingWindows.Devices.Gpio;usingwindows.foundation;usingWindows.Foundation.Collections;usingWindows.UI.Xaml;usingWindows.UI.Xaml.Controls;usingWindows.UI.Xaml.Controls.Primitives;usingWindows.UI.Xaml.Data;usingWindows.UI.Xaml.Input;usingWindows.UI.Xaml.Media;usingWindows.UI.Xaml.Navigation;// https://go.microsoft.com/fwlink/?LinkId=402352"Blank page" item template is described on &clcid=0x804namespacemyiot{/// <summary>    ///a blank page that can be used for itself or to navigate inside a Frame. /// </summary>     Public Sealed Partial classMainpage:page {PrivateGpiopin Pin4; PrivateGpiopin Pin5input; PrivateDispatcherTimer timer1;  PublicMainPage () { This.            InitializeComponent (); Gpiocontroller Gpio=Gpiocontroller.getdefault (); Pin4= Gpio. Openpin (4); Pin5input= Gpio. Openpin (5); Pin4.            Setdrivemode (Gpiopindrivemode.output);            Pin5input.setdrivemode (Gpiopindrivemode.input); Timer1=NewDispatcherTimer (); Timer1. Interval= Timespan.frommilliseconds ( -); Timer1. Tick+=Timer1_Tick; Timer1.                    Start (); }        Private voidTimer1_Tick (ObjectSenderObjecte) {gpiopinvalue value=Pin5input.read (); if(Value = =gpiopinvalue.high) {pin4.                Write (Gpiopinvalue.high);  This. Infotext.text ="Pin5input is high"; }            Else if(Value = =gpiopinvalue.low) {pin4.                Write (Gpiopinvalue.low);  This. Infotext.text ="Pin5input is low"; }        }        Private voidSubmitaction_click (Objectsender, RoutedEventArgs e)        {App.Current.Exit (); }    }}

Remember to add: Windows IoT Extensions for the UWP reference.

Blinkled Lighting The first LED light (C #)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.