First at all thanks a lot on effort, it is really easy to listen events.
I am trying to listen GIPO on Raspberry pi 4 b
Following your examples I do get event raised on connecting GPIO with GND.
But I do not know how to make distinct between closing and opening circuit.
Whenever circuit is closed or open I do get event.
Perhaps I am missing something, can you please help me to find distinct between open and close event.
Here is my code so far
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Staring app");
using var controller = new GpioController();
var clock = 0L;
var paused = false;
var collection = new SubscriptionCollection
{
ClockEnabled = true, // Optional, defaults false
ClockRate = TimeSpan.FromMilliseconds(500) // Optional, defaults to 500ms
};
collection.Subscribe(6, PinMode.InputPullUp, PinEventTypes.Falling);
var subscriptionService = collection.Build();
await foreach (var subEvent in subscriptionService.Run(controller, CancellationToken.None))
{
if (subEvent.IsClock && !paused)
{
clock += subEvent.Delta;
Console.WriteLine($"Tick {clock}");
}
else
{
Console.WriteLine($"Pin is {subEvent?.PinNumber ?? 0}");
clock = 0L;
}
}
}
}
First at all thanks a lot on effort, it is really easy to listen events.
I am trying to listen GIPO on Raspberry pi 4 b
Following your examples I do get event raised on connecting GPIO with GND.
But I do not know how to make distinct between closing and opening circuit.
Whenever circuit is closed or open I do get event.
Perhaps I am missing something, can you please help me to find distinct between open and close event.
Here is my code so far