- Because it’s fun and you’ll learn something new.
- Because you’ll be able to automate your home and do lots of cool things with it.
- Because it’s cheaper than commercial alternatives, especially if you want to own multiple ones. I make mine under 10$.
For controlling device over the internet we add the code that allows us to connect to our local Wi-Fi network, and run a simple webserver. In the setup() function, we configure the pin as an OUTPUT, use the WiFi object to connect to our local Wi-Fi network, and print out the assigned IP address. Then, we use the server object to create 2 routes to our ESP8266 application. We want to print out a “usage message” (in JSON format) when a user navigates to the top level path “/”, and we want to toggle the relay on and off when a user navigates to the “/rel=on” or “/rel=off” path.
Comments