Running Demo Codes
To run the demo code, perform the following on VisionFive 2 Debian:
- Locate to the directory where the test code, edge_detection_with_waiting_time.py, exists:
- Under the sample-code directory, execute the following command to execute the demo code:
sudo python edge_detection_with_waiting_time.py
Alternatively, you can execute the following command:
sudo python3 edge_detection_with_waiting_time.py
Result:- The terminal displays as follows:
# python3 edge_detection_with_waiting_time.py *-----------------------Case 1-----------------------------------------------------* Note: don't press the key on pin 37 once within 5 seconds !!!
- After waiting for 5 seconds, the terminal displays as follows:
Edge hasn't been detected within 5 seconds while setting 5 seconds to timeout. The return value of GPIO.event_detected(37) within 5 seconds: False *-----------------------Case 2-----------------------------------------------------------------------* Please press the key on pin 37 once at any time !!!
- Finally press the button, and the terminal displays as follows:
Edge has detected while setting -1 to timeout, timeout -1 means waiting until edge is detected. The return value (True) of GPIO.event_detected(37) should be True. The return value (False) of GPIO.event_detected(37) should be False, because of the secondly reading.
- The terminal displays as follows: