ESP8266 mDNS For Web Address URL Using Arduino IDE (Mac OSX and Windows)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi I'm Cisco with AK robotic and I'm here to show you another tip for working with your esp8266 microcontroller when we connect our esp8266 to our local Wi-Fi network it gets an IP address assigned by our wireless router when we then set up a web server running on the esp8266 we use that IP address to access different routes that call different functions that are part of our firmware the problem with that IP address is that it takes an extra step to find out what it is it can change over time and it can be difficult to remember if you're working with different devices so today we're going to be showing you how to assign an easy-to-remember web address to your esp8266 using multicast DNS or mdns for short you can read more about multicast DNS using the link in the description of this video but for our purposes what we want to do is set up a web address like esp8266 - sure one the local to access the different functions that would be running on our esp8266 so to do that let's start with a simple web server code that we've been using before and copy it to a new directory that I'll call web server underscore mdns and let's rename the firmware file from simple web server to much the new name of the directory we can go ahead and open up that file and if you remember we use a couple of libraries that allowed us to first connect to Wi-Fi and secondly to establish a couple of routes that executed two different functions as we access them so I'll go ahead and open up the file and the first thing we need is to include an additional library called esp8266 mdns dot h and inside that library we now have access to a class that it's called mdns responder that we'll use to declare an object that I'll name mdns with that object we can use the begin method in order to create the web address that we'll be using which I'll name esp8266 dash zero one and we don't need the actual domain name which by default will be the local the second parameter that this method needs is the IP address of the esp8266 that we can use using the local IP method of the Wi-Fi object and I'll go ahead and correct this typo [Music] since this method actually blocks then the rest of our code will not execute until it completes so I'm going to add a conditional statement that when it evaluates to true it'll print out a message to the user saying something like mdns responder has started lastly we're going to be using the mdns built-in object to call the method at service which requires three parameters these parameters describe the type of service that we want to broadcast over the network and in this case we want to use HTTP over TCP on 480 and that's it we can go ahead and connect our board and test out the code with our board connected we can go back to the Arduino IDE and hit the upload button then we can open our serial monitor reset the board needed and see first the IP address and the little print out message that we gave us the mdns responders started if we then go to our browser we can type in the address that we chose in this case esp8266 0 1 which was specified right here on the MD NSW game method go ahead and navigate to that and if you remember it'll do the same thing that we had before on the simple web server code which is printing out a simple hello world message then if we navigate to the other path that we had set up which stuggle we can turn the LED on and off one more time there you go if you like our videos you can go to our channel and click the support button but whatever you do don't forget to Like subscribe or leave us a comment until next time you
Info
Channel: ACROBOTIC
Views: 31,268
Rating: undefined out of 5
Keywords: ESP32, ESP8266, Arduino, IDE, NodeMcu, Tutorials, Makers, Learn, Guide, IoT, Internet Of Things, Raspberry Pi, Wireless, Communication, Weather, Creative, Sensor, Python, Programming, C++, Beginner, Electronics, DIY, MicroPython, 3d Printing, CAD, Fusion 360, Education, Tutorial, Intro, Introduction, Web, Developer, HTML, Datalogger, Project, Sensors, Data, Visualization, Webserver, Server, Client, App, WebApp, Wemos, Robot, Robotics, Robots, Easy, Adafruit, Sparkfun, OS X, Windows, Linux, Embedded, Kickstarter, RC, Fun, Build, Engineering
Id: ewrF1LzrxH8
Channel Id: undefined
Length: 5min 53sec (353 seconds)
Published: Wed Jan 04 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.