Page 1 of 1

Need some help with python script with button and if santanc

Posted: Sun Jan 31, 2016 9:19 pm
by Usr164
Hi guys. I made a script for my lights. Can you check the code and pleas tell me whats wrong because nothing happens when I click the button?


import RPi.GPIO as GPIO
import time

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(18,GPIO.OUT)

while True:
input_state = GPIO.input(21)

if input_state == False and GPIO.output == 1:
print "1" and GPIO.output(18,0)

elif input_state == False and GPIO.output == 0:
print "1" and GPIO.output(18,1)

Re: Need some help with python script with button and if san

Posted: Mon Feb 01, 2016 3:50 am
by SonOfAMotherlessGoat