- Once you've opened VS Code
- Click
EXTENSIONSon the menu towards the left - Type in the search bar the following items and click
INSTALL- Remote -SSH
- C/C++
- C/C++ Extension packs
- Press Windows key
- Type in search bar
Powershell - Type in the following in your Powershell instance and the Notepad application should launch
notepad $PROFILE - Enter the following in your Notepad instance
- Save the written contents
# You can pick whatever numerical value for local host # Example --> $env:DISPLAY = "localhost:10.0 $env:DISPLAY = "localhost:10.0"
- Restart Powershell
- You MUST close and re-open PowerShell for the changes to take effect
- To double check if the
DISPLAYvariable was saved, copy/paste the following
$env:DISPLAY Changing the PowerShell Execution Policy - Open Powershell - Enter the followingbash Set-ExecutionPolicy RemoteSigned- You'll be prompted the following, just enter [Y] to confirm the action hit ENTERExecution Policy Change The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):
- Press Windows key
- Type in the search bar
ENVIRONMENT VARIABLESthen press ENTER- Click on
Edit the system environment variables - Once the
Enironment Variableswindow pops up, click onnew- For
Variable nameenterDISPLAY - For
Variable valueenter the local host value you set earlier in your NotePad instance- In this example, set
localhosttolocalhost:10.0
- In this example, set
- For
- Click on
- Open
PowershellpressWindows key - Type in the following
mkdir .ssh- Enter the following
ssh-keygen -t ed25519-
When prompted :
Enter file in which to save the key (/home/local/.ssh/id_rsa)Choose.ssh- Just press ENTER
Enter passphrase (empty for no passphrase):- Just press ENTER
Enter same passphrase again:- Just press ENTER again
-
You'll then be prompted with your
key fingerprintand your key'srandomart imageas shown in the example screenshot below
-
Find the directory where your newly generated SSH keys are stored
- In my case, it's in the following directory
- Copy the newly generated SSH key since we're going to paste it into a different file in the Raspberry PI/Linux device
C:\Users\S123456789\.ssh- Use the
lscommand to list the contents of the.sshdirectory - We're going to need the
public keythat has the.pubending as shown in the screenshot below - You can use either
VIorVIMto view the contents of yourpublic key
- Type in the following commands in your Raspberry PI terminal
cd ~
sudo nano ~/.ssh/authorized_keys- If the
.sshfolder DOESN'T exist, use the following commands
cd ~
mkdir authorized_keys
sudo nano ~/.ssh/authorized_keys- Then :
- Paste your
.pubSSH key into theauthorized_keysfile - Press
Control + X-->Y-->ENTERto save and exit out of the file
- Paste your
- Open a terminal on the Raspberry PI
- Type in the following and take note of the value that's displayed under the
wlan0sectionifconfig

-
On your host machine
-
Open a Powershell instance
-
Use the :
-
cdcommand to return back to the.sshfolder -
-ls -acommand to list everything stored in the.sshfolder- You should see a
configfile- If not, use the following command
vim config
- Use either
vimornanoto edit theconfigfile and enter the following WITHOUT THE BRACKETS
Host [YOUR RASPBERRY PI IP ADDRESS] HostName [YOUR RASPBERRY PI IP ADDRESS] User [YOUR RASPBERRY PI USER NAME] ForwardAgent yes ForwardX11 yes ForwardX11Trusted yes # Example Host 192.123.56.111 HostName 192.123.56.111 User pi ForwardAgent yes ForwardX11 yes ForwardX11Trusted yes - You should see a
-
-
-
Upon running the setup file
- Select
Multiple Windows
- Select
-
Set the
Display numberto whatever value you set yourlocalhost:10.0to- Which in this case is 10
-
Select
Start no client -
Select
Disable access control
-
Open VS Code - Right click on
Remote-SSH -
Click on
Extension Settings -
Ensure the following boxes are checked:
-
Establish connection to host
- Press
Control + Shift + P - Type in the following :
connect to hostand choose either option - Click on
Add New SSH Host - To verify that you're connected to the Raspberry PI you can :
- Press
-
To open a project that's saved on the Raspberry PI
- Click the first icon on the left side menu
- Click on
Open Folder- Then you can navagate to the
Desktopwhere the repository should be stored
- Then you can navagate to the
- In VS Code find the
runoption - Afterwards you should see a .vscode folder in the
EXPLORERmenu - A
launch.jsonfile should be generated at this point
-
Set a break point anywhere in the
main.cppfile as indicated by theRED ARROW
-
There's two ways to run the Debugger
-
In the
Runoptions you can manually selectStart Debugger- Or you can just pressF5 -
Once the Debugger runs
- The
yellow lineindicates where you're at in the program - The menu circled in red does the following
- The
playbutton- When pressed, the program will run until it hits the next breakpoint
- The
step-overbutton- When pressed, if the next line the debugger is about to 'step into' is a function, you can esentially skip over it
- The
step intobutton- As the name implies, you can step into any function
- Or manually step through every line of code to have a better understanding of what's going on with the program
- The
step outbutton- When pressed while in a C++ function
- You can 'exit' out of the function and use a different debugging command
- The
restartandstopbutton- I'm pretty sure these buttons can explain themselves
- The
- The



















