I in this lecture want to show you how to write and execute a very, very simple with the simplest possible
really micro python program.
We are going to run it using the ID in a couple of different ways.
So let me show you first.
Bring up your idea, Ed, and this time I'm going to open up these files.
Sidebar on the left side of the macro python window so you can see that my experience is already connected
to my computer via the USB cable, and I'm not seeing it, though, on my environment.
So I'm going to check first that I have selected the correct interpreter and I have not.
So let's switch that to the hospital, to the appropriate port down here.
That's the first thing to do, make sure that we have a connection.
Then we have the correct device selected.
So since I did that, you can see that the micro part of the device did appear here again under the
psy ops tab.
And because this is a very fresh installation, I just thought the firmware a couple of years ago,
the only thing that appears, the only file that appears on the device is the boot P1.
I'm going to talk more about the people in the next section, which is dedicated to making Python on
the E.S.P 32.
I just double clicked on it and the file company appeared in the new tab.
They could see the contents are lines of code that come out.
So they're not going to have any effect and there's just some python command.
But you can totally forget about this right now because we don't really need it.
What I want to do is to run a very simple program.
First, I'm going to run the program on the shell.
Which is basically the problem is just one single line of code, and then I'm going to create a file
which would allow me to run the program as a file using microprocessor.
So the program is the classic world.
I'm just going to say print and then like the string of text.
I want to print out
words from Michael Python and say into this instruction, then Michael Python running on the two will
print out this message.
Now, you notice that I entered this command on the comment from the Michael Python command prompt,
which is running on my HP three two.
So this is the interactive show or also known as recall.
So whenever you hear a report, basically what it means is the ability to issue commands life essentially
with two micro python and have those commands execute it immediately in any way that you want to go
about executing programs in the macro python, especially for larger programs, of course, is to do
so.
One is to do so in a file like this.
So just copied my single command.
But the small program into a file I'm going to enter a convent is what I'm going to use.
The sharp symbol precision, like a simple python program.
And I'm going to say this program, the only idea it gives me a choice of where is it that I'd like
to see this program that my computer or the Python device in this instance, I'm going to go for the
computer and that will give me the option to store it somewhere.
So let's say I'm going to put it.
On this location and just saying hello, world, be watching as the final system and say that.
All right, so you can see that that program appeared right here.
And now what I can do is to click on this green button and have the program executed.
Now, this is sometimes a confusing concept for people new to Python and to eat what just happened is
that I've got a small python program without a safety net.
I've got a Python program here stored on my computer, which was executed on the E.S.P 30 device.
So you can see that I'm connected again to my python running the city, too.
And this program is stored on a file on my computer, which, upon pressing the green button, was sent
to the ISP three to four execution.
It was executed and then its output came back to me on the show.
So this is one way of doing this.
Another way is, of course, to have the Python script stored on the device itself.
So there's a couple of ways by which you can do that.
The easiest way, since we already have this file on our local machines to right click and then select
upload to forge, which is going to send the file and stored on the E.S.P 32 flash file system.
Now, if I double click on it, you'll see that a new tab comes up.
It's called Square Brackets with the same file name.
And the square brackets indicate that this file is stored on the device.
No square brackets means that the file is stored on my computer.
So then once I had the father I would execute with, regardless of whether it's on the computer or on
the computer to the same thing, just press on the green button or F5 and it will execute it.
Really this absolutely no difference.
Once you have the file, regardless of where the final is, it will be executed.
By sending it to the appropriate interpreter, which you have selected and the only options.
All right, there are a few instances of this system that we're going to explore a little later, those
nuisances have to do with dependencies.
For example, what if her children go to their file that is stored on my computer?
What if there is a dependency in my program?
For example, what if there is a module that is required by this program which is not stored on the
micro python device, then can you just be able to upload and execute this file on the device?
You also need to take care of those dependencies.
And there are a few examples later on in this course where I show you how that works.
In particular, if you are curious, then you want to go ahead, have a look at the Wi-Fi example with
a Wi-Fi example.
There are dependencies.
We've got, for example, a Jason text file that contains Wi-Fi network credentials, things of that
sort that the program depends on.
And those dependencies will ultimately be stored on the micropayment device.
Or obviously, we're going to do a lot more into how to write that and execute programs on the ability
to use in micro python.
But in this quick introduction, I just want to show you the simplest possible way of doing that.
In the next lecture, I want to do a simple demonstration of some of the other capabilities and features
of learning and in particular of the heap and the stack and fireballs.
Patents, which are interesting from the point of view of using them during Python programming, they
are not very useful in terms of micro python programming.
But nevertheless, these questions that I often get and I wanted to just show you what these three page.
Listed, at least.