I am using two pins of GPIO as input and I want to check whether both are high or low at a time so I want to use a logical AND operation to check the status of both the pins, but I coudnt get that right as I have wrote few lines as below.
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(11,GPIO.OUT) GPIO.setup(12,GPIO.OUT) GPIO.output(11,1) GPIO.output(12,1) time.sleep(1) GPIO.output(11,0) GPIO.output(12,0) while True: if(GPIO.output(11) && GPIO.output(12) == 1) print"both the leds are ON" else: print"both the LED's are OFF"
But this is'nt working. So please help me. How can I get this logical operations done? Error I am facing is 'syntax error'.