check_gpio_in
Watches the GPIO input pin and prints every change, without launching Village.
For testing what is wired to GPIO_IN (a switch, a TTL, …). It uses the same logic as village/devices/gpio.py: a gpiozero DigitalInputDevice with the internal pull-down, and callbacks on OFF -> ON (trigger_on) and ON -> OFF (trigger_off).
Village must not be running (the pin would be busy). Run it on the Raspberry:
python3 village/scripts/check_gpio_in.py # pin 26, like GPIO_IN python3 village/scripts/check_gpio_in.py –pin 17 python3 village/scripts/check_gpio_in.py –pull up # internal pull-up
Stop it with Ctrl+C.
Each change is printed with the time since the previous one: a mechanical switch usually bounces, which shows up as several changes a few ms apart.
(Not named test_*.py on purpose: pytest would collect it as a test.)
Functions
|
Parses the arguments and watches the pin until Ctrl+C. |