1
00:00:00,650 --> 00:00:07,230
I in this lecture want to show you how to write and execute a very, very simple with the simplest possible

2
00:00:07,230 --> 00:00:09,660
really micro python program.

3
00:00:10,050 --> 00:00:14,940
We are going to run it using the ID in a couple of different ways.

4
00:00:15,700 --> 00:00:17,250
So let me show you first.

5
00:00:17,640 --> 00:00:24,450
Bring up your idea, Ed, and this time I'm going to open up these files.

6
00:00:24,570 --> 00:00:34,080
Sidebar on the left side of the macro python window so you can see that my experience is already connected

7
00:00:34,080 --> 00:00:39,810
to my computer via the USB cable, and I'm not seeing it, though, on my environment.

8
00:00:39,810 --> 00:00:45,870
So I'm going to check first that I have selected the correct interpreter and I have not.

9
00:00:45,900 --> 00:00:50,920
So let's switch that to the hospital, to the appropriate port down here.

10
00:00:50,950 --> 00:00:54,600
That's the first thing to do, make sure that we have a connection.

11
00:00:54,600 --> 00:00:58,510
Then we have the correct device selected.

12
00:00:59,190 --> 00:01:04,140
So since I did that, you can see that the micro part of the device did appear here again under the

13
00:01:04,140 --> 00:01:05,040
psy ops tab.

14
00:01:05,170 --> 00:01:10,560
And because this is a very fresh installation, I just thought the firmware a couple of years ago,

15
00:01:10,920 --> 00:01:16,410
the only thing that appears, the only file that appears on the device is the boot P1.

16
00:01:16,900 --> 00:01:23,210
I'm going to talk more about the people in the next section, which is dedicated to making Python on

17
00:01:23,220 --> 00:01:24,410
the E.S.P 32.

18
00:01:25,020 --> 00:01:30,450
I just double clicked on it and the file company appeared in the new tab.

19
00:01:30,450 --> 00:01:34,460
They could see the contents are lines of code that come out.

20
00:01:34,470 --> 00:01:39,180
So they're not going to have any effect and there's just some python command.

21
00:01:39,300 --> 00:01:43,260
But you can totally forget about this right now because we don't really need it.

22
00:01:43,770 --> 00:01:47,530
What I want to do is to run a very simple program.

23
00:01:47,550 --> 00:01:50,630
First, I'm going to run the program on the shell.

24
00:01:51,630 --> 00:01:56,460
Which is basically the problem is just one single line of code, and then I'm going to create a file

25
00:01:57,000 --> 00:02:02,860
which would allow me to run the program as a file using microprocessor.

26
00:02:03,360 --> 00:02:05,770
So the program is the classic world.

27
00:02:05,970 --> 00:02:12,270
I'm just going to say print and then like the string of text.

28
00:02:13,720 --> 00:02:15,310
I want to print out

29
00:02:19,510 --> 00:02:32,140
words from Michael Python and say into this instruction, then Michael Python running on the two will

30
00:02:32,140 --> 00:02:33,460
print out this message.

31
00:02:33,820 --> 00:02:40,030
Now, you notice that I entered this command on the comment from the Michael Python command prompt,

32
00:02:40,450 --> 00:02:43,000
which is running on my HP three two.

33
00:02:43,610 --> 00:02:48,150
So this is the interactive show or also known as recall.

34
00:02:48,670 --> 00:02:56,560
So whenever you hear a report, basically what it means is the ability to issue commands life essentially

35
00:02:57,060 --> 00:03:03,550
with two micro python and have those commands execute it immediately in any way that you want to go

36
00:03:03,550 --> 00:03:10,510
about executing programs in the macro python, especially for larger programs, of course, is to do

37
00:03:10,520 --> 00:03:11,080
so.

38
00:03:11,110 --> 00:03:15,360
One is to do so in a file like this.

39
00:03:15,850 --> 00:03:17,950
So just copied my single command.

40
00:03:17,960 --> 00:03:26,350
But the small program into a file I'm going to enter a convent is what I'm going to use.

41
00:03:26,350 --> 00:03:33,580
The sharp symbol precision, like a simple python program.

42
00:03:34,690 --> 00:03:43,180
And I'm going to say this program, the only idea it gives me a choice of where is it that I'd like

43
00:03:43,180 --> 00:03:49,360
to see this program that my computer or the Python device in this instance, I'm going to go for the

44
00:03:49,360 --> 00:03:54,820
computer and that will give me the option to store it somewhere.

45
00:03:54,850 --> 00:03:58,600
So let's say I'm going to put it.

46
00:03:59,470 --> 00:04:09,160
On this location and just saying hello, world, be watching as the final system and say that.

47
00:04:09,880 --> 00:04:13,800
All right, so you can see that that program appeared right here.

48
00:04:14,200 --> 00:04:21,310
And now what I can do is to click on this green button and have the program executed.

49
00:04:22,370 --> 00:04:33,170
Now, this is sometimes a confusing concept for people new to Python and to eat what just happened is

50
00:04:33,170 --> 00:04:36,160
that I've got a small python program without a safety net.

51
00:04:36,240 --> 00:04:44,810
I've got a Python program here stored on my computer, which was executed on the E.S.P 30 device.

52
00:04:45,410 --> 00:04:50,930
So you can see that I'm connected again to my python running the city, too.

53
00:04:51,140 --> 00:05:01,850
And this program is stored on a file on my computer, which, upon pressing the green button, was sent

54
00:05:01,850 --> 00:05:04,520
to the ISP three to four execution.

55
00:05:04,850 --> 00:05:09,870
It was executed and then its output came back to me on the show.

56
00:05:11,030 --> 00:05:12,380
So this is one way of doing this.

57
00:05:12,620 --> 00:05:19,730
Another way is, of course, to have the Python script stored on the device itself.

58
00:05:20,360 --> 00:05:22,480
So there's a couple of ways by which you can do that.

59
00:05:22,490 --> 00:05:29,660
The easiest way, since we already have this file on our local machines to right click and then select

60
00:05:29,660 --> 00:05:38,930
upload to forge, which is going to send the file and stored on the E.S.P 32 flash file system.

61
00:05:39,560 --> 00:05:44,470
Now, if I double click on it, you'll see that a new tab comes up.

62
00:05:44,870 --> 00:05:48,650
It's called Square Brackets with the same file name.

63
00:05:49,550 --> 00:05:54,260
And the square brackets indicate that this file is stored on the device.

64
00:05:54,770 --> 00:05:59,130
No square brackets means that the file is stored on my computer.

65
00:05:59,960 --> 00:06:07,040
So then once I had the father I would execute with, regardless of whether it's on the computer or on

66
00:06:07,040 --> 00:06:14,120
the computer to the same thing, just press on the green button or F5 and it will execute it.

67
00:06:14,720 --> 00:06:16,390
Really this absolutely no difference.

68
00:06:16,400 --> 00:06:21,410
Once you have the file, regardless of where the final is, it will be executed.

69
00:06:22,770 --> 00:06:28,680
By sending it to the appropriate interpreter, which you have selected and the only options.

70
00:06:32,090 --> 00:06:39,230
All right, there are a few instances of this system that we're going to explore a little later, those

71
00:06:39,230 --> 00:06:41,380
nuisances have to do with dependencies.

72
00:06:41,470 --> 00:06:47,690
For example, what if her children go to their file that is stored on my computer?

73
00:06:47,990 --> 00:06:50,810
What if there is a dependency in my program?

74
00:06:50,810 --> 00:07:00,500
For example, what if there is a module that is required by this program which is not stored on the

75
00:07:00,500 --> 00:07:08,010
micro python device, then can you just be able to upload and execute this file on the device?

76
00:07:08,030 --> 00:07:10,970
You also need to take care of those dependencies.

77
00:07:11,330 --> 00:07:15,980
And there are a few examples later on in this course where I show you how that works.

78
00:07:16,190 --> 00:07:22,400
In particular, if you are curious, then you want to go ahead, have a look at the Wi-Fi example with

79
00:07:22,400 --> 00:07:23,470
a Wi-Fi example.

80
00:07:23,540 --> 00:07:25,150
There are dependencies.

81
00:07:25,490 --> 00:07:33,560
We've got, for example, a Jason text file that contains Wi-Fi network credentials, things of that

82
00:07:33,560 --> 00:07:36,260
sort that the program depends on.

83
00:07:36,470 --> 00:07:40,640
And those dependencies will ultimately be stored on the micropayment device.

84
00:07:42,170 --> 00:07:48,320
Or obviously, we're going to do a lot more into how to write that and execute programs on the ability

85
00:07:48,320 --> 00:07:49,510
to use in micro python.

86
00:07:49,520 --> 00:07:54,110
But in this quick introduction, I just want to show you the simplest possible way of doing that.

87
00:07:54,890 --> 00:08:04,400
In the next lecture, I want to do a simple demonstration of some of the other capabilities and features

88
00:08:04,400 --> 00:08:10,880
of learning and in particular of the heap and the stack and fireballs.

89
00:08:12,030 --> 00:08:20,160
Patents, which are interesting from the point of view of using them during Python programming, they

90
00:08:20,160 --> 00:08:24,300
are not very useful in terms of micro python programming.

91
00:08:24,630 --> 00:08:32,620
But nevertheless, these questions that I often get and I wanted to just show you what these three page.

92
00:08:33,750 --> 00:08:34,590
Listed, at least.
