diff --git a/http/apple-touch-icon.png b/http/apple-touch-icon.png new file mode 100644 index 0000000..de91784 Binary files /dev/null and b/http/apple-touch-icon.png differ diff --git a/http/button.css b/http/garage_door_opener.css similarity index 95% rename from http/button.css rename to http/garage_door_opener.css index 91921c5..5e810f3 100644 --- a/http/button.css +++ b/http/garage_door_opener.css @@ -33,7 +33,7 @@ body { -webkit-box-shadow: inset 0 -1px 1px rgba(255, 255, 255, .15); -moz-box-shadow: inset 0 -1px 1px rgba(255, 255, 255, .15); box-shadow: inset 0 -1px 1px rgba(255, 255, 255, .15); - font-family: 'Pacifico', Arial, sans-serif; + font-family: 'Khand', sans-serif; line-height: 1; text-shadow: 0 -1px 1px rgba(175, 49, 95, .7); -webkit-transition: background-color .2s ease-in-out, -webkit-transform .1s ease-in-out; diff --git a/http/garage_door_opener.html b/http/garage_door_opener.html new file mode 100644 index 0000000..9071409 --- /dev/null +++ b/http/garage_door_opener.html @@ -0,0 +1,20 @@ + + + + + + + Garage Remote + + + + + Door 1 + + + Door 2 + + + + + diff --git a/http/garage_door_opener.lua b/http/garage_door_opener.lua new file mode 100644 index 0000000..e2fd8ae --- /dev/null +++ b/http/garage_door_opener.lua @@ -0,0 +1,30 @@ +-- garage_door_opener.lua +-- Part of nodemcu-httpserver, example. +-- Author: Marcos Kirsch + +local function pushTheButton(connection, pin) + + -- Redirect the user back to the static page where the garage door opener buttons are. + connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\Cache-Control: private, no-store\r\n\r\n") + connection:send('') + + -- push the button! + -- Note that the relays connected to the garage door opener are wired + -- to close when the GPIO pin is low. This way they don't activate when + -- the chip is reset and the GPIO pins are in input mode. + gpio.write(pin, gpio.LOW) + gpio.mode(pin, gpio.OUTPUT) + gpio.write(pin, gpio.LOW) + tmr.delay(300000) -- in microseconds + gpio.write(pin, gpio.HIGH) + gpio.mode(pin, gpio.INPUT) + +end + +return function (connection, args) + print('Garage door button was pressed!') + print('Door', args.door) + if args.door == "1" then pushTheButton(connection, 3) -- GPIO0 + elseif args.door == "2" then pushTheButton(connection, 4) -- GPIO2 + else dofile("httpserver-error.lc")(connection, {code = 400}) end -- Bad Request +end diff --git a/http/redirect.html b/http/redirect.html deleted file mode 100644 index 7c758a3..0000000 --- a/http/redirect.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/http/remote.html b/http/remote.html deleted file mode 100644 index e582aab..0000000 --- a/http/remote.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - Garage Remote - - - - - ¡Bienvenido! - - - - -