In this activity, we are going to practice with Python and the terminal.
So we're going to create a new script from the terminal, improve the code and execute it also from
the terminal.
So you have a few things to do for this challenge.
First.
Well I'm back to all my Python programs and I have my LED program which I'm going to print here on the
terminal.
So maybe you have this code, maybe you don't.
Well, it doesn't matter.
This is basically the blink LED example.
So by now this code should be quite easy for you.
If needed, you can just rewrite it if you already have the file.
Well that's good.
So you're going to start by creating a new file.
So this is going to be activity 9.py.
So you create that from the terminal.
You might even just create it by copying that file into the new file okay with the CP command.
And then you're going to run this file.
And actually you're going to make a test.
You're going to run this file from Sony and then try to run it also from the terminal.
And you're going to see the difference.
So if you remember we had a kind of an issue with this program.
And this was that when we run this program.
And we stopped it from Sony when the LED was on, then the LED was still on, meaning that the Gpio
was not correctly cleaned up and that could be an issue.
So I'm not saying more about this.
Just run it from Sony, run it from the terminal, and note if there is any difference.
And then after that, as a third step, you're going to improve this code here so that you can catch
the keyboard interrupt.
So you will need the try and except block.
You can add this to the program.
All right.
And I will see you in the next video for the solution.