Hallo!
Script stops with this error:
pin-a = 18
^
SyntaxError: can’t assign to operator
What do I need to change to make it work?
´´´
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
pin-a = 18
pin-b = 24
def discharge():
GPIO.setup(pin-a, GPIO.IN)
GPIO.setup(pin-b, GPIO.OUT)
GPIO.output(pin-b, False)
time.sleep(0.004)
def charge_time():
GPIO.setup(pin-b, GPIO.IN)
GPIO.setup(pin-a, GPIO.OUT)
count = 0
GPIO.output(pin-a, True)
while not GPIO.input(b_pin):
count = count + 1
return count
def analog_read():
discharge()
return charge_time()
while True:
print(analog_read())
time.sleep(1)
´´´