В момента ресурсът е наличен само на английски

Start your first Python program in the Raspberry Pro Preview

Here we will start sending manual commands to our Raspberry Pi micro-computer and it will execute them for us.

Необходимо е да се абонирате за FLLCasts.com, за да достъпите това видео

Абонирай се

  • #830
  • 09 Apr 2018

TL;DR.

Type

cd Perfect_Programs

then

python ledOn.py

and a diode on GPIO 18 will blink again.

 

The command line

Now that you have established SSH connection to the Raspberry, you are in its command line interface in short CLI. We also refer to it as the Console. 
This interface looks rather boring, but it is the most powerful computer tool that you will have, if you master it. The power comes from the possibility to send commands to your computer - hense Command Line. The commands can be anything: copy a file, open a file for reading, restart the computer, or even delete every last thing in the computer.

Keep in mind that you can use TAB to force completion of commands and ask for filenames sugessions. A similar concept is implemented when typing Minecraft commands.

 

Change directories a.k.a folders

First we need to go where the python programs live in the Raspberry. That actually can be anywhere in the computer, but now we go to a specific folder.
The command "cd" is short from "change directory" and we will go in folder Perfect_Programs with the help of the command

student@PerfectPi:~$ cd Perfect_Programs/

Hint: you can see long list of folders and programs in the current directory with the command "ll" (double L).

 

Ask Python to execute a program

In the folder Perfect_Programs there is one special program that you already have observed working. Its name is ledOn.py and it causes ... Actually, see for yourself.
Ask Python to execute the program ledOn.py with the following command:

student@PerfectPi:~/Perfect_Programs$ python ledOn.py

Курсове и занятия включващи този Урок

Този Урок е използван в следните курсове и занятия.

Image for Perfect STEM course. Module 1 - Smart Car with Raspberry PI
  • 118
  • 42:47
  • 136