1. Prerequisites
Visual Studio Code is a source-code editor, and as such it requires a desktop environment to draw its full potential. For that, we will have to make sure our OS image has a desktop environment. One way of checking is to connect the PLC to a PC screen using an HDMI cable.
If we are sure the image on our PLC does not have a desktop environment, we will have to burn a new OS image on the SD card. Careful! Doing so will remove all data stored in it, so we might want to do a backup of the important files and store them somewhere else for later retrieval.
Our personal choice is starting with the "Raspberry Pi OS (Legacy, 32-bit)" found on the official Raspberry Pi imager, and build the PLC image in it. For further reading on how to do that, check the following blog:
How to build a Raspberry PLC image from a Raspberry Pi OS
2. Install VScode
Installing Visual Studio Code on a Debian based OS is as easy as it gets. Simply type the following command on the terminal:
~$ sudo apt-get install code
From then on, Visual Studio Code will be accessible from the Raspberry Pi desktop.
Using Visual Studio Code on Raspberry PLC