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
Steps to set up a raspberry pi controller for the actuators
Connect a relay for a pump
Refer to the following schematics:
Use the library from git as referenced in the other module
Example script
importRPi.GPIOasGPIOfromtimeimportsleepdefpump_water(sec, pump_pin):
print("Pumping water for {} seconds...".format(sec))
# set GPIO mode and set up the pump pinGPIO.setmode(GPIO.BCM)
GPIO.setup(pump_pin, GPIO.OUT)
try:
# turn the pump off for 0.25 secondsGPIO.output(pump_pin, GPIO.LOW)
sleep(0.25)
# turn the pump on for the given timeGPIO.output(pump_pin, GPIO.HIGH)
sleep(sec)
# turn the pump offGPIO.cleanup()
print("Done pumping water.")
exceptKeyboardInterrupt:
# stop pump when ctrl-c is pressedGPIO.cleanup()