I'm Trying to make app send a pulse to a relay. I got it done with a Button_click, but now I want to do it with any keystroke. What Can I use for this? I read about KeyDown but I don't really know how to integrate it, Any help would be much appreciated. Thank you in advance!
Here is how my code looks like:
private void Button_Click(object sender, RoutedEventArgs e)
{
if (relay_state == 0)
{
relayPin.Write(GpioPinValue.Low);
relay_state = 1;
}
else if (relay_state == 1)
{
relayPin.Write(GpioPinValue.High);
relay_state = 0;
}