Hi and welcome to a new section in this course in this section.
I'm going to show you how to use the Wi-Fi capabilities of the ESPN three to my controller using micro
python.
And I'm going to do that by guiding you through a series of lectures which contain examples on how to
interact with various Web resources to send and receive data using simple requests, especially to get
and post hated requests.
In this first lecture of the section, I want to walk you through some of the fundamental resources
that will be using again and again throughout these lectures and in a way set the ground for what you're
about to learn and what you're about to see.
So let's begin.
First of all, let's talk a little bit about the practical examples that you're about to see.
I'm going to be using resources such as DeWit, DOD, Eyo, and if this and that and open weather map
do it as well as my own website in order to play around with the capabilities of micro python when it
comes to interacting with Web resources, for example, with the DOD, I will show you how you can use
tweets to API and rest API to Sentara with.
If this event, I'll show you how to generate an email from a post requests coming from your HP 32 with
dummy.
Since the data, I'm going to show you how to get the current weather conditions for anywhere on the
planet using a weather map, dot org and its open API.
And to begin with, I'm going to show you something very simple, which is how to read this text file,
which I have uploaded onto my own website, a very simple way to get started.
So these are some of the things that we'll be doing and will be, of course, analyzing in detail what's
happening with each one of these examples, especially in terms of the software.
Now, having said software, let's flip over to the other side, have a look at the hardware and basically
this is it to conduct all of the experiments in this section, you just need to be able to microcontroller
connected to your computer.
And we're not going to use any pitfalls around that just to keep things as simple as possible.
Whenever we need to use some sensor data to send them to our remote web resource or just simulate the
sense of data with random numbers, that's just good enough since our focus here is on the Wi-Fi and
communications capabilities and methodologies instead of the hardware components that could generate
real world data sets of data.
All right.
Now about the individual software components that pretty much all of our examples groups will be using
a first one to show you the networking module.
So I'm looking at the quick reference for the E.S.P three to here and there that you'll find networking.
And this is just an example of how you can set your ISP 32 to use your Wi-Fi network.
All you've got to do is to create the wireless LAN object.
Basically, you posted this comment here and it will land.
And then inside the parentheses, you pass a parameter that indicates a type of network that you want
to connect to or that you want to create.
So you got really two options.
The first one is the one that you will be using in the examples that follow.
You are connecting to a station that exists to a hotspot, in other words.
Alternatively, if you need, you can create an access point interface, which means that you can get
your authority to act as an access point.
I'm not going to be using this mode of operation, but if anyone is interested in this enough interest
out there, I may consider creating one or more lectures exploring this capability as well.
After that, we activate the interface.
Then you can use this scan method to look around for wi fi hotspots in this command would actually list
them onto the schill or we're not going to be doing that because we know which network we want to connect
to by the network name and password.
So then we can use the connect.
Method, we passed the name of the network in a password and that achieves connection.
After that, we can start using the wi fi connection and sent out HATSUKO requests and send and receive
data from around the Internet.
So this is the first one.
Next, I'll be using Jason or the Jason module, and in particular the some of the micro Jason module
that comes with my code python to help me deal with Jason files.
Either Jason files that code wi fi or remote asset credentials in a separate file outside of the Micro
Python script, or in some cases, for example, with the DOD does enter open a weather map that's there
as well.
The response coming from those resources is Jason formatted file.
And therefore, I'm going to use you, Jason, to decode it or to encode it as I'm sending data in and
out of the you Jason module that comes with micro python is a micro implementation of the C or C language
python module called Jason.
So I've also linked to the actual C Python Jason module because here you can see full examples of how
to use Jason.
You, Jason, is a partial implementation of the full C language Python Jason module and it only implements
certain functions here.
So as I said, it's a micro implementation of the full chasten module.
So basically the way that you can use this is to use this documentation to see which of the Jason functions
have been implemented in Micro Jason.
And then you can go to the full Jason documentation and look at how those particular implemented functions
works at this dump, for example, which is implemented in micro.
Jason, you can learn about its actual use by looking at the full C language python implementation of
the same function.
Of course, I'll be showing you how I'm using Micro Jason in the example scripts.
Another very important module that I'll be using in all of the examples is your requests, which is
a micro implementation of the full requests module that is available in Python.
So this is not a core component of the Python language, but it's a third party module and it basically
makes it very easy to do get post delete in other types of requests so you can see the full vocabulary
that's available here.
And what I really like about your requests and requests, of course, is how easy it is to learn and
to use.
So basically, here it is.
You just need to import requests or requests in our case and to do a simple get request.
It's easy as one line of code another that we can just simply read and interact with the response that
we're getting from the server that is now stored in this example, our object, which is the response
object you can see here.
So in other words, just to finish with this segment, the requests module that will be using in all
of the examples that are coming up is a implementation or micro implementation of the full Python requests
module it provides us with.
These features will be using the get and post verbs here for the vocabulary.
And if you want to learn more about how to use it, you can refer to the documentation.
But of course, it's, as I said, so simple to use that.
Just looking at the example scripts that I have prepared will be enough to get you a long way through
implementing your own scripts and your own requirements from your scripts.
OK, so that's about it.
With the preliminaries, let's jump into the next lecture.
We'll show you how to do that simple yet request.