Button-Operated Servo Motor with Raspberry Pi (Button Priority/Blocking to Handle a Race Condition)

Опубликовано: 28 Сентябрь 2024
на канале: M Heidenreich
7,389
75

This video demonstrates how to implement a simple software-based button blocking/priority technique with Raspberry Pi GPIO and Python. The concept is demonstrated with a servo motor but can be applied in other settings as well.

0:00 Intro
0:40 Safety First
1:11 Schematic Diagram
2:05 Servo Calibration
3:00 Basic Code for Slow Servo Movement
4:33 Safe Program Exit
5:15 Button Priority Implementation
6:22 Full Code

Full code download: https://github.com/mheidenreich/Butto...
(Note: code posted may contain small updates and/or bug fixes not shown in the video)

You may receive a warning when you run your program: PWMSoftwareFallback: To reduce servo jitter, use the pigpio pin factory. See https://gpiozero.readthedocs.io/en/st... for more info 'To reduce servo jitter, use the pigpio pin factory.'

The above is normal, as the default library uses software-based PWM to control the servo. Watch my other servo video to find out how to make your servo jitter-free:    • Raspberry Pi Robotics: DC Motors and ...  

Disclaimer:
"Raspberry Pi" and the distinct logo are a trademark of the Raspberry Pi Foundation.

Music: Endless Motion By Bensound.com, https://www.bensound.com/