Commit 7dd4099b authored by Kristian Tan's avatar Kristian Tan

Rebase to squash commits

parent 0eaf6a29
...@@ -32,6 +32,8 @@ def main(): ...@@ -32,6 +32,8 @@ def main():
# The function below is executed when someone requests a URL with the pin number and action in it: # The function below is executed when someone requests a URL with the pin number and action in it:
@app.route("/<change_pin>") @app.route("/<change_pin>")
def action(change_pin): def action(change_pin):
if change_pin == 'favicon.ico':
return "here"
change_pin = int(change_pin) change_pin = int(change_pin)
device_name = pins[change_pin]['name'] device_name = pins[change_pin]['name']
print("Input value before change: " + str(GPIO.input(change_pin))) print("Input value before change: " + str(GPIO.input(change_pin)))
...@@ -47,9 +49,9 @@ def action(change_pin): ...@@ -47,9 +49,9 @@ def action(change_pin):
message = "Turned " + device_name message = "Turned " + device_name
if GPIO.input(change_pin) == 0: if GPIO.input(change_pin) == 0:
message += "off." message += " off."
else: else:
message += "on." message += " on."
for pin in pins: for pin in pins:
pins[pin]['state'] = GPIO.input(pin) pins[pin]['state'] = GPIO.input(pin)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment