Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4474

Automation, sensing and robotics • Execution of scripts when pressing buttons connected to GPIO.

$
0
0
Good day everyone. I have a Raspberry Pi 4b.
I am still a beginner, as due to my work I have absolutely no time to study raspberry pi in depth.
And I would be very grateful if anyone from the respected community suggested or showed a ready solution how to run scripts when pressing physical buttons connected to GPIO pins.
There are only two buttons (b1 and b2) and the scenario is as follows:
A single press of b1 runs the script b1-0.sh
A quick double press of b1 starts the script b1-1.sh
Long (more than five seconds) pressing b1 starts the script b1-2.sh

And the same algorithm with button b2
Pressing b2 once starts the script b2-0.sh
A quick double press of b2 starts the script b2-1.sh.
A long (more than five seconds) press of b2 runs the script b2-2.sh

I have searched the forum, but so far I have not been able to figure out how to implement such a thing.
Probably someone will be interested in this and will be able to offer a solution to this problem.
Thanks everyone!

Statistics: Posted by smak15 — Thu Jun 20, 2024 8:37 pm — Replies 1 — Views 43



Viewing all articles
Browse latest Browse all 4474

Trending Articles