Introduction

This application note provides steps to use VisionFive 2's GPIO pins to detect rising edge and falling edge in a specified time through an example program with Python. Detecting the rising or falling edge means detecting the signal of the button.

Tip: VisonFive.gpio is compatible with the RPi.GPIO command, which means that the RPi.GPIO python demo can be run on VisionFive 2. In addition, the callback function of API add_event_detect() has been optimized compared to RPi.GPIO, which adds a edge_type parameter in callback function. Therefore, the python demo of RPi.GPIO related to callback functions needs to be modified manually by adding edge_type parameter.