WEBVTT

00:00.110 --> 00:03.980
In this activity, we are going to practice with Python and the terminal.

00:03.980 --> 00:08.510
So we're going to create a new script from the terminal, improve the code and execute it also from

00:08.510 --> 00:09.170
the terminal.

00:09.170 --> 00:11.990
So you have a few things to do for this challenge.

00:11.990 --> 00:12.530
First.

00:12.560 --> 00:20.150
Well I'm back to all my Python programs and I have my LED program which I'm going to print here on the

00:20.150 --> 00:21.050
terminal.

00:21.170 --> 00:23.300
So maybe you have this code, maybe you don't.

00:23.330 --> 00:24.620
Well, it doesn't matter.

00:24.620 --> 00:27.230
This is basically the blink LED example.

00:27.230 --> 00:29.600
So by now this code should be quite easy for you.

00:29.600 --> 00:32.780
If needed, you can just rewrite it if you already have the file.

00:32.780 --> 00:33.530
Well that's good.

00:33.530 --> 00:35.930
So you're going to start by creating a new file.

00:35.930 --> 00:39.080
So this is going to be activity 9.py.

00:39.110 --> 00:40.940
So you create that from the terminal.

00:40.940 --> 00:47.090
You might even just create it by copying that file into the new file okay with the CP command.

00:47.090 --> 00:48.650
And then you're going to run this file.

00:48.650 --> 00:49.970
And actually you're going to make a test.

00:49.970 --> 00:54.590
You're going to run this file from Sony and then try to run it also from the terminal.

00:54.590 --> 00:56.630
And you're going to see the difference.

00:56.630 --> 01:00.470
So if you remember we had a kind of an issue with this program.

01:00.470 --> 01:02.780
And this was that when we run this program.

01:02.780 --> 01:10.460
And we stopped it from Sony when the LED was on, then the LED was still on, meaning that the Gpio

01:10.490 --> 01:13.280
was not correctly cleaned up and that could be an issue.

01:13.280 --> 01:14.840
So I'm not saying more about this.

01:14.840 --> 01:19.910
Just run it from Sony, run it from the terminal, and note if there is any difference.

01:19.910 --> 01:25.700
And then after that, as a third step, you're going to improve this code here so that you can catch

01:25.700 --> 01:27.470
the keyboard interrupt.

01:27.470 --> 01:29.660
So you will need the try and except block.

01:29.660 --> 01:31.370
You can add this to the program.

01:31.400 --> 01:31.760
All right.

01:31.790 --> 01:34.550
And I will see you in the next video for the solution.
