summaryrefslogtreecommitdiff
path: root/water_the_plant
diff options
context:
space:
mode:
Diffstat (limited to 'water_the_plant')
-rwxr-xr-xwater_the_plant22
1 files changed, 22 insertions, 0 deletions
diff --git a/water_the_plant b/water_the_plant
new file mode 100755
index 0000000..bdfed4d
--- /dev/null
+++ b/water_the_plant
@@ -0,0 +1,22 @@
+#!/usr/bin/python3
+import RPi.GPIO as GPIO
+import time
+
+# GPIO-Modus auf BCM setzen
+GPIO.setmode(GPIO.BCM)
+
+# GPIO4 als Ausgang konfigurieren
+GPIO.setup(4, GPIO.OUT)
+
+try:
+ # GPIO4 einschalten
+ GPIO.output(4, GPIO.LOW)
+ # 1 Sekunde warten
+ time.sleep(4)
+ # GPIO4 ausschalten
+ GPIO.output(4, GPIO.HIGH)
+finally:
+ # Ressourcen freigeben
+ GPIO.cleanup()
+
+