There is an example of a programme that differentiates between long and short push-button pushes on the Arduino.cc website, but I was not taken it. However their was an example I did like the look of, ...
We can investigate the fundamentals and basic concepts of the Robot Operating System (ROS) using only an Arduino, a Raspberry Pi, and a tactile push button switch. With these electronic components, we ...