gpio pwm init

This commit is contained in:
Bernd Reuther 2021-03-03 21:46:06 +01:00
parent 06781f4732
commit 8ba00075f0

View File

@ -30,13 +30,13 @@ for key, value in pins_pwm.items():
def main(): def main():
# For each pin, read the pin state and store it in the pins dictionary: # For each pin, read the pin state and store it in the pins dictionary:
for pin in pins_out: for pin in pins_out:
pins[pin]['state'] = GPIO.input(pins_out[pin]['nr']) pins_out[pin]['state'] = GPIO.input(pins_out[pin]['nr'])
for pin in pins_in: for pin in pins_in:
pins_in[pin]['state'] = GPIO.input(pins_in[pin]['nr']) pins_in[pin]['state'] = GPIO.input(pins_in[pin]['nr'])
# Put the pin dictionary into the template data dictionary: # Put the pin dictionary into the template data dictionary:
templateData = { templateData = {
'pins' : pins, 'pins' : pins_out,
'pins_in' : pins_in 'pins_in' : pins_in
} }
# Pass the template data into the template main.html and return it to the user # Pass the template data into the template main.html and return it to the user
@ -67,7 +67,7 @@ def action(changePin, action):
# Along with the pin dictionary, put the message into the template data dictionary: # Along with the pin dictionary, put the message into the template data dictionary:
templateData = { templateData = {
'pins' : pins, 'pins' : pins_out,
'pins_in' : pins_in 'pins_in' : pins_in
} }