Visual Studio Code for programming a Raspberry Pi
Lesser Detail
To wrap up the VS Code console tour, I'll describe some of the Activity Bar items not used. The magnifying glass icon represents the Search view, in which you can search for and optionally replace content within the current editor or across multiple files.
The Source Control view (the source tree icon) provides access to source control software that tracks and manages changes to code. Recall when first preparing the Raspberry Pi environment that you installed the Git software package. Git is the most commonly used version control system today. VS Code provides support for Git through the Source Control view.
If Git is established in the Source Control environment and the project being worked on is in a Git repository, then the view will show relevant Git information, such as how many files have been changed and which files have been changed and staged, and will even commit your changes.
Source Control is important even to the amateur developer, and it can be relied on as a form of code backup. After you have spent your time writing the code, it would be nice for it to stick around if your Raspberry Pi development environment were to fail. If Git is using a repository, then the code is safe.
The Run view (an arrow with a bug), the final Activity Bar item to be mentioned, establishes a Python debugging environment. When you select the Run view icon, the debugger needs the launch.json
configuration file. The file will be displayed with some default configurations. A .vscode
folder is created to hold this file.
VS Code debugging allows you to step through code line by line and fix problems. To stop code at a specific point, you can establish breakpoints and conditional breakpoints. Debugging also enables log points for coding [4].
Summary
VS Code provides a development environment that will make you a more efficient Raspberry Pi coder by taking over some of the tasks and freeing time for you to focus on what is important – writing code. Until next time, keep your Pi in that creative oven.
Infos
- Visual Studio Code: https://code.visualstudio.com/
- VS Code Raspberry Pi install: https://code.headmelted.com/
- PEP 8 style guide: https://www.python.org/dev/peps/pep-0008/
- Visual Studio Code for Python developers: https://www.lynda.com/Visual-Studio-tutorials/Visual-Studio-Code-Python-Developers/784291-2.html
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)