Writing code for the Raspberry Pi using Visual Studio Code

0 Comments

So you have a Raspberry Pi and you're unsure how to use your favorite code editor, Visual Studio Code. You thought, it's Linux, so Code should just work. Well friend, that's not the case but there is light at the end of the tunnel. Below I'll show you how to use Visual Studio Code with your Raspberry Pi using the Remote SSH extension.

Get the best of both worlds

You can stay in your Windows environment and code on the Raspberry Pi. To do this, you'll need a few things:

  1. Visual Studio Code
  2. Remote SSH extension
  3. Raspberry Pi, connected to your network with SSH enabled

Install the Remote - SSH extension

The Remote - SSH extensionf or VS Code is what lets you connect to your Raspberry Pi. Install this and you'll have a bunch of new commands available, including Connect to Host.

Connect to Host...

Use the Connect to Host... command to type in the IP address of your Raspberry Pi. To get the IP address, you can first type hostname -I on the Pi. Code will create a new Window for the remote session and prompt you for your Raspberry PI password.

You'll know it's a success when Code shows the SSH connection icon in the lower left of the window.

Wrapping Up

That's it! Terminal sessions are running on the Raspberry Pi, so you can easily execute commands from your Code session without switching back over to the Pi. This makes creating new files, folders, shutdown, etc. super easy. Let me know what awesome things you're creating with the Pi!

Comments