Initial commit

This commit is contained in:
teguhrzo
2025-07-10 21:59:56 +07:00
commit bf97953ffd
170 changed files with 8613 additions and 0 deletions

21
Button.py Normal file
View File

@ -0,0 +1,21 @@
import RPi.GPIO as GPIO
import time
# Konfigurasi GPIO
BUTTON_PIN = 22 # Pin GPIO yang digunakan
GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) # Pull-down resistor
print("Tekan tombol untuk menguji...")
try:
while True:
if GPIO.input(BUTTON_PIN) == GPIO.HIGH:
print("Tombol ditekan!")
else:
print("Tombol tidak ditekan.")
time.sleep(0.1) # Delay untuk menghindari pembacaan terlalu cepat
except KeyboardInterrupt:
print("Program dihentikan.")
finally:
GPIO.cleanup()