You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importRPi.GPIOasGPIOimporttime# Set up the GPIO pins for the irrigation valve and the pumpGPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.setup(23, GPIO.OUT)
# Define a function to water the treedefwaterTree():
# Open the irrigation valveGPIO.output(18, GPIO.HIGH)
# Turn on the pumpGPIO.output(23, GPIO.HIGH)
# Wait for 5 minutestime.sleep(300)
# Close the irrigation valveGPIO.output(18, GPIO.LOW)
# Turn off the pumpGPIO.output(23, GPIO.LOW)
# Water the tree every day at 10amwhileTrue:
# Get the current timenow=time.localtime()
# Check if the current time is 10amifnow.tm_hour==10andnow.tm_min==0:
# Water the treewaterTree()
# Wait for 1 secondtime.sleep(1)
documentationImprovements or additions to documentation
1 participant
Converted from issue
This discussion was converted from issue #4 on January 01, 2024 13:48.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Beta Was this translation helpful? Give feedback.
All reactions