WEBVTT

00:00.080 --> 00:01.580
It's time for a new activity.

00:01.580 --> 00:06.440
And in this activity you will practice with the Raspberry Pi camera module.

00:06.440 --> 00:07.880
So here's your challenge.

00:07.880 --> 00:10.220
You will need to take a series of photo.

00:10.220 --> 00:15.080
So you take one new photo every for example every five seconds.

00:15.080 --> 00:19.010
And you're going to store all those photos inside a folder okay.

00:19.040 --> 00:22.670
You continue to take photos as long as the program runs.

00:22.670 --> 00:25.940
And then when the user stops, the user is going to be you.

00:25.970 --> 00:32.330
When you stop the program with Ctrl C from the terminal, also from the shell, then you're going to

00:32.330 --> 00:34.610
stop taking photos so the program will exit.

00:34.610 --> 00:37.850
And here are a few tips to help you get started.

00:37.850 --> 00:45.680
So first of all, if you remember we have the OS module and you have a way to find if the path exists

00:45.680 --> 00:48.290
so that you already know, then if it doesn't exist.

00:48.290 --> 00:55.790
So if the folder doesn't exist, you're going to use OS dot mkdir and provide a folder name.

00:56.000 --> 00:58.430
So we will need to use this function here.

00:58.430 --> 01:01.070
For the folder name you can use whatever you want okay.

01:01.100 --> 01:03.800
For example activity ten or whatever.

01:03.800 --> 01:06.740
So if the folder doesn't exist you create it.

01:06.740 --> 01:12.920
And I'm not sure if I showed that to you before, but if you want to test that something is true, you

01:12.920 --> 01:14.180
do if okay.

01:14.210 --> 01:18.560
And then for example, something if this is true, you do something.

01:18.590 --> 01:25.280
For example, I put this block here, but if you want to execute this block, if this is false.

01:25.310 --> 01:29.000
What you can do is you can add a not keyword.

01:29.000 --> 01:35.840
So for example here, if you test if it doesn't exist, you can just test if it exists and put the not

01:35.840 --> 01:36.890
keyword in front.

01:36.890 --> 01:39.830
And it's going to return the opposite of true or false.

01:39.830 --> 01:42.410
So if it's true this is going to be false.

01:42.440 --> 01:42.830
Okay.

01:42.860 --> 01:46.130
If this is false then this is going to be true.

01:46.160 --> 01:46.670
All right.

01:46.670 --> 01:49.640
So here you will be able to use the Not keyword.

01:49.640 --> 01:53.540
So if not the folder exists then we create the folder.

01:53.570 --> 01:54.020
Great.

01:54.020 --> 01:56.570
And then you will initialize the camera.

01:56.570 --> 01:58.700
And you will need to take a photo.

01:58.700 --> 02:02.030
So with a loop probably a loop every five seconds.

02:02.030 --> 02:09.830
Now if you use the same file name every time, what you saw previously is that the new folder will replace

02:09.830 --> 02:10.940
the previous one.

02:10.940 --> 02:13.550
And what you want to do here instead is to take a new.

02:13.550 --> 02:16.850
So to create a new file name every time you take a new photo.

02:16.850 --> 02:25.250
So for example the first file would be image one dot jpg and then image two dot jpg, image three,

02:25.280 --> 02:26.360
etc..

02:26.390 --> 02:26.810
All right.

02:26.810 --> 02:32.240
So in the loop you will need to find a way to create a new file name every time.

02:32.240 --> 02:34.400
So you will need to increment a number.

02:34.400 --> 02:37.610
And also to work with concatenation of strings.

02:37.610 --> 02:42.830
And then once again when the user presses Ctrl C the program is going to end.

02:42.860 --> 02:43.190
All right.

02:43.220 --> 02:45.800
Now that's enough information for you to get started.

02:45.800 --> 02:48.950
And I will see you in the next video for the solution.
