dvd
dvd
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Yep, I think something got disconnected
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Also fun little problem, i noticed if i hover my finger like a half an inch / few mm above the button it is already activating lol
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Ill give this a try, thanks for all the help Canton
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Alright, thanks!
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
if not thats fine too, I think this was in one of my open tabs but i couldnt figure it out or find a guide online
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Could you give me pointers on how to implement that? I'm not really certain how to do it
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
ideally it wouldnt matter how quickly you spam the button
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Yeah, im not sure how to best approach that
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Im gonna try yours now, one slight edit because I just did the order wrong for Rising and Falling; it was spamming falling over and over until i would press and hold the button
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Yeah good point
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
thats true
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
static async Task PinEvent4(CancellationToken token)
{
while (!token.IsCancellationRequested)
{
WaitForEventResult waitResult;
waitResult = await _controller.WaitForEventAsync(4, PinEventTypes.Falling, token);
do
{
if (!waitResult.TimedOut)
{
Console.WriteLine(
$"[Button 4, ChangeType={waitResult.EventTypes}");
await Task.Delay(100);
waitResult.EventTypes = PinEventTypes.Rising;
}
} while (waitResult.EventTypes != PinEventTypes.Rising);
await Task.Delay(500, token);
}
}
static async Task PinEvent4(CancellationToken token)
{
while (!token.IsCancellationRequested)
{
WaitForEventResult waitResult;
waitResult = await _controller.WaitForEventAsync(4, PinEventTypes.Falling, token);
do
{
if (!waitResult.TimedOut)
{
Console.WriteLine(
$"[Button 4, ChangeType={waitResult.EventTypes}");
await Task.Delay(100);
waitResult.EventTypes = PinEventTypes.Rising;
}
} while (waitResult.EventTypes != PinEventTypes.Rising);
await Task.Delay(500, token);
}
}
This is what i have now, made it a bit shorter since that Console.WriteLine doesnt need to be very detailed anyway
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Yeah
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
I will say this current code is the result of just throwing shit at the wall and seeing what sticks, i think i overcomplicated it for no reason
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
And only do that once, for every time i press a button
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
But my basic goal is to have a press of 'button 1' result in 'Button 1 was pressed' to show up in console (I mean later there will be logic tied to what it needs to execute but thats not important for now)
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Im not sure what you mean with print all edges
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
I think i should flip them actually, i only picked falling because it was spamming on rising
62 replies
CC#
Created by dvd on 1/9/2023 in #help
❔ GPIO listening to button events (Raspbery Pi w breakout board)
Yeah that stopped it from repeating
62 replies