Today we will make the first sketch with the Wemos d1 mini, is a very
simple sketch that shows the first operation.
Start with opening the Arduino IDE (configuration Wemos d1 mini and Arduino IDE) and click on File --> Examples --> ESP8266WiFi --> WiFiWebServer.
Write on the SSID variable the SSID of your
router and write on the password variable your router password.
Once this is done, connect via USB the Wemos and run the program, once
the Arduino IDE has completed open the Serial Monitor, reset the Wemos and
after a few seconds on the Serial Monitor (if all goes well) will be written IP
address of your esp8266 that the router has associated.
Now we have
to try the program, so open an Internet browser and put this address http: //
server_ip where instead of server_ip put the IP address of your ESP8266.
Finally completed
the address by entering / gpio / 0 or /
gpio / 1 and run it, then the full address will be http: // your_server_ip / gpio / 0 or http: // your_server_ip / gpio / 1.
These are the basic commands of esp8266 that are used to turn on and off the LED that is located on esp8266, in particular, control the digital pin 2 of also called GPIO2 esp8266.
These are the basic commands of esp8266 that are used to turn on and off the LED that is located on esp8266, in particular, control the digital pin 2 of also called GPIO2 esp8266.
Once you
executed the two addresses you will see (If all goes well) the LED on and off
and esp8266 sends you a feedback on Serial Monitor where is the command that
you sent.
- Problems
1) If fails
the switch on and off, try changing from pin 2 program with the written
BUILTIN_LED this is the Wemos pin that is associated with the led of ESP8266.
2) If after
this change still does not go, it is probably because the esp8266 has an IP
address not stable, so from the router settings you have to assign a new stable
address at esp8266
3) If there
are other problems, try to contact me and let's try to solve it. 😉
Well if you are here it means that you were able to create your first WiFi Web Server,
congratulations !!!!
The next time we will see how to associate a DDNS address to ESP8266 and we will create a first application to command our esp8266 from the smartphone.
Stay tuned!!!
ABR
No comments:
Post a Comment