import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(3,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(5,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(7,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(8,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(10,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(11,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(12,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(13,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(15,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(16,GPIO.IN,pull_up_down=GPIO.PUD_UP)

GPIO.setup(18,GPIO.OUT)
GPIO.setup(19,GPIO.OUT)
GPIO.setup(21,GPIO.OUT)
GPIO.setup(22,GPIO.OUT)
GPIO.setup(23,GPIO.OUT)
GPIO.setup(24,GPIO.OUT)
GPIO.setup(26,GPIO.OUT)
GPIO.setup(29,GPIO.OUT)
GPIO.setup(31,GPIO.OUT)
GPIO.setup(32,GPIO.OUT)
GPIO.setup(33,GPIO.OUT)

while True:
	if GPIO.input(3)==0:
		GPIO.output(18,1)
		GPIO.output(19,0)
		GPIO.output(21,0)
		GPIO.output(22,0)
		GPIO.output(23,0)
		GPIO.output(24,0)
		GPIO.output(26,0)
		GPIO.output(29,0)
		GPIO.output(31,0)
		GPIO.output(32,0)
		GPIO.output(33,1)				
		print " 1 up"
		time.sleep(0.1)   
	elif GPIO.input(5)==0:
                GPIO.output(18,0)
		GPIO.output(19,1)
		GPIO.output(21,0)
		GPIO.output(22,0)
		GPIO.output(23,0)
		GPIO.output(24,0)
		GPIO.output(26,0)
		GPIO.output(29,0)
		GPIO.output(31,0)
		GPIO.output(32,0)
		GPIO.output(33,1)					
		print " 1 down"
		time.sleep(0.1)   
	elif GPIO.input(7)==0:
                GPIO.output(18,0)
		GPIO.output(19,0)
		GPIO.output(21,1)
		GPIO.output(22,0)
		GPIO.output(23,0)
		GPIO.output(24,0)
		GPIO.output(26,0)
		GPIO.output(29,0)
		GPIO.output(31,0)
		GPIO.output(32,0)
		GPIO.output(33,1)					
		print " 2 up "
		time.sleep(0.1)
	elif GPIO.input(8)==0:
                GPIO.output(18,0)
		GPIO.output(19,0)
		GPIO.output(21,0)
		GPIO.output(22,1)
		GPIO.output(23,0)
		GPIO.output(24,0)
		GPIO.output(26,0)
		GPIO.output(29,0)
		GPIO.output(31,0)
		GPIO.output(32,0)
		GPIO.output(33,1)					
		print " 2 down"
		time.sleep(0.1)
	elif GPIO.input(10)==0:
                GPIO.output(18,0)
		GPIO.output(19,0)
		GPIO.output(21,0)
		GPIO.output(22,0)
		GPIO.output(23,1)
		GPIO.output(24,0)
		GPIO.output(26,0)
		GPIO.output(29,0)
		GPIO.output(31,0)
		GPIO.output(32,0)
		GPIO.output(33,1)					
		print " 3 up"
		time.sleep(0.1)
	elif GPIO.input(11)==0:
                GPIO.output(18,0)
		GPIO.output(19,0)
		GPIO.output(21,0)
		GPIO.output(22,0)
		GPIO.output(23,0)
		GPIO.output(24,1)
		GPIO.output(26,0)
		GPIO.output(29,0)
		GPIO.output(31,0)
		GPIO.output(32,0)
		GPIO.output(33,1)					
		print " 3 down "
		time.sleep(0.1)   
	elif GPIO.input(12)==0:
                GPIO.output(18,0)
		GPIO.output(19,0)
		GPIO.output(21,0)
		GPIO.output(22,0)
		GPIO.output(23,0)
		GPIO.output(24,0)
		GPIO.output(26,1)
		GPIO.output(29,0)
		GPIO.output(31,0)
		GPIO.output(32,0)
		GPIO.output(33,1)					
		print " 4 up "
		time.sleep(0.1)
	elif GPIO.input(13)==0:
                GPIO.output(18,0)
		GPIO.output(19,0)
		GPIO.output(21,0)
		GPIO.output(22,0)
		GPIO.output(23,0)
		GPIO.output(24,0)
		GPIO.output(26,0)
		GPIO.output(29,1)
		GPIO.output(31,0)
		GPIO.output(32,0)
		GPIO.output(33,1)					
		print " 4 down "
		time.sleep(0.1)
	elif GPIO.input(15)==0:
                GPIO.output(18,0)
		GPIO.output(19,0)
		GPIO.output(21,0)
		GPIO.output(22,0)
		GPIO.output(23,0)
		GPIO.output(24,0)
		GPIO.output(26,0)
		GPIO.output(29,0)
		GPIO.output(31,1)
		GPIO.output(32,0)
		GPIO.output(33,1)					
		print " 5 up "
		time.sleep(0.1)
	elif GPIO.input(16)==0:
                GPIO.output(18,0)
		GPIO.output(19,0)
		GPIO.output(21,0)
		GPIO.output(22,0)
		GPIO.output(23,0)
		GPIO.output(24,0)
		GPIO.output(26,0)
		GPIO.output(29,0)
		GPIO.output(31,0)
		GPIO.output(32,1)
		GPIO.output(33,1)					
		print " 5 down "
		time.sleep(0.1)
	else:
                GPIO.output(18,0)
		GPIO.output(19,0)
		GPIO.output(21,0)
		GPIO.output(22,0)
		GPIO.output(23,0)
		GPIO.output(24,0)
		GPIO.output(26,0)
		GPIO.output(29,0)
		GPIO.output(31,0)
		GPIO.output(32,0)	
		print " all off"

		
GPIO.cleanup()    
