suresh sarika
Published © TAPR-OHL

Water Pump Controller

Controlling water pump using on and off buttons.

IntermediateFull instructions provided24,904
Water Pump Controller

Things used in this project

Story

Read more

Code

Control water pump with Raspberry Pi

Python
import RPi.GPIO as GPIO       	# Import required Python libraries
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)
from Tkinter import*
myGui=Tk()
while True:
	def onlamp():
		GPIO.output(7,True)
	def offlamp():
		GPIO.output(7,False)
	myGui.title("Hello")
	myGui.geometry("200x350+200+200")
	while True:
		myButton1=Button(text='on',fg='black',bg='green',command=onlamp).pack()
		myButton2=Button(text='off',fg='black',bg='green',command=offlamp).pack()
		myGui.mainloop()
	

Credits

suresh sarika

suresh sarika

3 projects • 7 followers

Comments