Setting the GPIO pin output

To set the actual output value, we call the Write() method on the pin object:

bool LastOn = await RuntimeSettings.GetAsync("Actuator.Output", 
   false); 
this.gpioPin.Write(LastOn ? GpioPinValue.High : GpioPinValue.Low); 

We need to make a similar change in the SetOutput() method.

The Actuator project in the MIOT repository uses the Arduino use case by default. The GPIO code is also available through conditional compiling. It is activated by uncommenting the GPIO switch definition on the first row of the App.xaml.cs file.
You can also perform Digital Input using principles similar to the preceding ones, with some differences. First, you select an input drive mode: Input, InputPullUp or InputPullDown. You then use the Read() method to read the current state of the pin. You can also use the ValueChanged event to get a notification whenever the input pin changes value.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset