We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7da9ac3 commit 494e7d2Copy full SHA for 494e7d2
1 file changed
scripts/test_up.py
@@ -0,0 +1,33 @@
1
+# test_up.py
2
+import time
3
+import RPi.GPIO as GPIO
4
+
5
+UP_PIN = 17 # BCM numbering, physical pin 11
6
7
+GPIO.setmode(GPIO.BCM)
8
9
+def release_up():
10
+ # High-impedance: "button not pressed"
11
+ GPIO.setup(UP_PIN, GPIO.IN, pull_up_down=GPIO.PUD_OFF)
12
13
+def press_up():
14
+ # Drive low: "button pressed"
15
+ GPIO.setup(UP_PIN, GPIO.OUT, initial=GPIO.LOW)
16
17
+try:
18
+ # Make sure we're released at start
19
+ release_up()
20
+ print("Ready. Desk should NOT move yet.")
21
22
+ input("Press Enter to move UP for 2 seconds...")
23
24
+ print("Moving UP...")
25
+ press_up()
26
+ time.sleep(2.0) # adjust if you want a shorter/longer test
27
28
+ print("Released UP. Test finished.")
29
30
+finally:
31
+ # Ensure we leave the line released
32
33
+ GPIO.cleanup()
0 commit comments