<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ vscode extensions - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ vscode extensions - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Mon, 25 May 2026 10:49:40 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/vscode-extensions/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Use Your Raspberry Pi Headlessly with VS Code and SSH (No Monitor Needed) ]]>
                </title>
                <description>
                    <![CDATA[ The Raspberry Pi is a portable computer with an onboard processor that fits comfortably in the palm of your hand. Compared with general purpose computers, it’s an affordable option developed by the Raspberry Pi Foundation. The Raspberry Pi Model B wa... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-use-your-raspberry-pi-headlessly-with-vs-code-and-ssh/</link>
                <guid isPermaLink="false">6835cf3101fd0876c3c66de0</guid>
                
                    <category>
                        <![CDATA[ Raspberry Pi ]]>
                    </category>
                
                    <category>
                        <![CDATA[ ssh ]]>
                    </category>
                
                    <category>
                        <![CDATA[ vscode extensions ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Josiah Adesola ]]>
                </dc:creator>
                <pubDate>Tue, 27 May 2025 14:41:53 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1748452192906/594a76a0-be8f-478b-a9ae-e3ba55850c65.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The Raspberry Pi is a portable computer with an onboard processor that fits comfortably in the palm of your hand. Compared with general purpose computers, it’s an affordable option developed by the <a target="_blank" href="https://www.raspberrypi.org/">Raspberry Pi Foundation</a>.</p>
<p>The Raspberry Pi Model B was introduced in 2012 as the first sellable unit, and the company has since released many more models. There are even low-cost models like the Raspberry Pi Zero Series, which is quite small and tailored to embedded systems applications. All the models operate on an operating system called the Raspberry Pi OS, a Linux flavor niched for Raspberry PI Computers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747912686077/498ff16a-c6a0-4774-b6e4-a0d573afd4f8.jpeg" alt="A Raspberry Pi Model 4B single-board computer with visible ports, components." class="image--center mx-auto" width="768" height="1020" loading="lazy"></p>
<p>In this tutorial, we’ll be using the Raspberry Pi 4 Model for a headless setup through a SSH connection using Visual Studio Code (VS Code). The Raspberry Pi 4 Model has a Quad-core ARM Cortex-A72 (64-bit) SoC at 1.5GHz, up to 8GB RAM options, video inputs, Ethernet shield, USB ports, MicroSD card slot for storage, USB-C power input and 40 General Purpose Inputs and Outputs Pins (GPIO). Impressive, right?</p>
<p>You’ll be able to use the Raspberry Pi as a personal computer, for home automation and IoT projects, robotics projects, network applications, educational tools, and Artificial Intelligence projects.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-understanding-the-headless-setup">Understanding the Headless Setup</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-prerequisites">Prerequisites</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-preparing-the-microsd-card">Preparing the MicroSD Card</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-boot-the-raspberry-pi">How to Boot the Raspberry Pi</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-understanding-the-led-of-the-raspberry-pi-during-setup">Understanding the LED of the Raspberry Pi During Setup</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-establish-an-ssh-connection">How to Establish an SSH Connection</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-set-up-visual-studio-code-for-remote-development">How to Set Up Visual Studio Code for Remote Development</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-write-and-run-the-code-remotely">How to Write and Run the Code Remotely</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></p>
</li>
</ul>
<h2 id="heading-understanding-the-headless-setup">Understanding the Headless Setup</h2>
<p>Many Raspberry Pi computers are sold with additional peripherals, including a keyboard, mouse, and monitor, that are essential for the Raspberry Pi's setup. A headless setup is the process of configuring the Raspberry Pi or preparing it for use without needing these peripherals. This entails operating the Raspberry Pi through a network protocol like SSH (Secure Shell) or VNC (Virtual Network Computing).</p>
<p>This is really helpful when you don’t need peripherals, as it lets you use your personal computer to connect to the Raspberry Pi without needing to purchase specialized peripherals. It’s also excellent for remote access. This headless setup is also essential for remote monitoring systems, such as surveillance systems with remote camera access, and IoT systems.</p>
<p><a target="_blank" href="https://www.raspberrypi.com/products/raspberry-pi-400/"><img src="https://assets.raspberrypi.com/static/neat-lg@2x-38697d13d9952791ca96da4891de9a12.jpg" alt="A Raspberry Pi 400 in use on a desk, with a mouse and monitor connected" width="2600" height="1800" loading="lazy"></a></p>
<p>Remote development lets you write code and modify your Raspberry Pi and other devices connected to the GPIO pins through a headless configuration via SSH.</p>
<p>SSH guarantees a secure connection for transferring and modifying files, as well as transferring and debugging commands from one computer (your personal computer) to another computer (the Raspberry Pi). It restricts unauthorized access from any other system that aims to intercept the communication channel.</p>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>Here’s what you’ll need to follow along with this tutorial:</p>
<h3 id="heading-hardware-requirements">Hardware Requirements</h3>
<ol>
<li><p>Raspberry Pi 4 or 5</p>
</li>
<li><p>MicroSD Card (8GB or higher recommended)</p>
</li>
<li><p>Flash Drive with SD Card Slot or a MicroSD Card Adapter</p>
</li>
<li><p>Power Supply (5V 2A/3A)</p>
</li>
<li><p>Network Connection (Wi-Fi, Pi, and laptop must be on the same network)</p>
</li>
<li><p>Personal Computer (Windows, macOS, Linux)</p>
</li>
</ol>
<h3 id="heading-software-requirements">Software Requirements</h3>
<ol>
<li><p>Raspberry Pi Operating System (Raspberry Pi OS)</p>
</li>
<li><p>Visual Studio Code</p>
</li>
<li><p>Remote SSH Extension in VS Code</p>
</li>
</ol>
<h2 id="heading-preparing-the-microsd-card">Preparing the MicroSD Card</h2>
<p>The Raspberry Pi requires a MicroSD Card that serves as the storage of your the Raspberry Pi OS using Raspberry Pi Imager. The operating system of the Raspberry Pi provides a graphical interface to interact with the Raspberry Pi, store files and datasets, and write commands to get your Raspberry Pi working.</p>
<p>But the Raspberry Pi needs an empty MicroSD Card to install the Raspberry Pi OS in the MicroSD Card. Here are some step by step instructions that’ll show you how to get your MicroSD Card setup before inserting it back into the Raspberry Pi for SSH Connection.</p>
<h3 id="heading-downloading-and-flashing-raspberry-pi-os">Downloading and flashing Raspberry Pi OS</h3>
<h4 id="heading-insert-your-microsd-card-into-a-flash-drive-with-a-sd-card-slot">Insert your MicroSD Card into a flash drive with a SD Card slot</h4>
<p>Aside from using a flash drive with an SD Card slot (so as to get the memory card connected to the computer), you can also use a SD Card adapter. Make sure it’s inserted into your computer where you have the Raspberry PI Imager downloaded to flash – that is, transfer the OS into the SD Card.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747921369222/7deebdff-d0bc-4f08-9aab-07c562a712bd.jpeg" alt="My flash drive with an SD card slot" class="image--center mx-auto" width="963" height="1280" loading="lazy"></p>
<h4 id="heading-download-the-raspberry-pi-imagerhttpswwwraspberrypicomsoftware-based-on-your-pcs-operating-system">Download the <a target="_blank" href="https://www.raspberrypi.com/software/">Raspberry Pi Imager</a> based on your PC’s operating system</h4>
<p>This involves clicking the link and selecting your operating system (either MacOS, Windows or Linux operating system). The Raspberry Pi OS comes in these variants for different OSes</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747922079380/d1aa21cb-3166-4924-8f98-e2f16816fec6.png" alt="Screenshot of a webpage from raspberrypi.com showing instructions for installing Raspberry Pi OS using Raspberry Pi Imager. It includes download links for Windows, macOS, and Ubuntu. There is a command for installing on Raspberry Pi OS and an image of the Raspberry Pi Imager interface." class="image--center mx-auto" width="872" height="947" loading="lazy"></p>
<h4 id="heading-next-install-and-open-the-raspberry-pi-imager">Next, install and open the Raspberry Pi imager</h4>
<p>Click the Raspberry Pi Imager download, follow all the instructions during the installation process. Once this screen pops up, you’re good to go!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747922173921/02e58463-0634-41d6-bc85-0a1a3a199996.png" alt="The image shows the Raspberry Pi Imager v1.8.5 interface. It has options to &quot;Choose Device,&quot; &quot;Choose OS,&quot; and &quot;Choose Storage.&quot; There is also a faded &quot;Next&quot; button at the bottom. The background is a shade of raspberry red." class="image--center mx-auto" width="1348" height="930" loading="lazy"></p>
<h4 id="heading-choose-your-raspberry-pi-device-and-operating-system-and-select-storage">Choose your Raspberry Pi Device and operating system and select Storage</h4>
<p>For each of the three configurations, you must select one sequentially. Select a device according to the type of Raspberry Pi you have, and various options will appear. I selected the Raspberry Pi 4, as it is my preferred device. You may choose between the Raspberry Pi 5 and the Raspberry Pi Zero 2 W, depending on your device requirements.</p>
<p>Next, proceed to the operating system – I would recommend choosing the 64-bit version. While many people opt for the legacy version (32-bit), I think the 64-bit version is best. Once you're finished, you can choose a storage option, and your MicroSD should appear. My storage is around 128GB, which is why you can see 125.1GB displayed there in the screenshot below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747922610658/d5f4c750-ab40-47ed-8c0c-fe5951f68660.png" alt="Screenshot of the Raspberry Pi Imager v1.8.5 interface. It shows options for selecting a Raspberry Pi device, operating system, and storage. Available devices include Raspberry Pi 5, 4, and Zero 2 W. Operating systems listed are Raspberry Pi OS in 64-bit and 32-bit versions, and there is a USB device listed for storage." class="image--center mx-auto" width="1080" height="1080" loading="lazy"></p>
<h4 id="heading-click-on-next-and-edit-the-settings">Click on “Next” and edit the settings</h4>
<p>It is a customary practice to keep your username as "pi", but it’s not required. The goal is to have something simple and easy to remember when setting up your SSH connection. It’s also helpful to make your password simple. I used 'roboticsai'.</p>
<p>Try to avoid using numbers simply to make things easier, because you may not be able to see what you are entering in the terminal. Then, make sure that your wireless LAN and SSID (WIFI or Hotspot name if you're using a phone, as well as the password for your WIFI or Hotspot) is the same network as the one linked to your computer.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747922797428/c1a1ae55-e109-4a35-878c-820d1ef3f406.png" alt="Setting up the username and password of the Raspberry Pi" class="image--center mx-auto" width="1077" height="1060" loading="lazy"></p>
<h4 id="heading-click-on-services-and-enable-ssh-then-use-password-authentication-for-security-and-click-on-save">Click on “SERVICES” and enable SSH. Then use password authentication for security and Click on “SAVE”.</h4>
<p>After you've completed the changes in the General Section, go to the Services section and click the checkbox button “<em>Enable SSH</em>”. Once highlighted, make sure you pick “<em>Use password authentication</em>”, avoid the “<em>RUN SSH-KEYGEN</em>” button at the moment, and then click Save.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747923037374/b6c63a5a-e3b6-4c9f-9612-53df7e566e41.png" alt="Screenshot of an OS customization window under the &quot;Services&quot; tab. &quot;Enable SSH&quot; is checked, with &quot;Use password authentication&quot; selected. An option for &quot;Allow public-key authentication only&quot; is available. A disabled &quot;RUN SSH-KEYGEN&quot; button and a &quot;SAVE&quot; button are visible." class="image--center mx-auto" width="1071" height="926" loading="lazy"></p>
<h4 id="heading-click-yes-to-apply-the-customizations-and-the-raspberry-pi-os-should-get-flashed-into-your-sd-card">Click “YES” to apply the customizations, and the Raspberry Pi OS should get flashed into your SD Card.</h4>
<p>Following the previous stage, you will be shown various buttons to apply the adjustments you have made. Pick yes, and the Raspberry Pi OS will be flashed or transferred to your Memory Card. This could take between 10 and 20 minutes to go from transferring to writing or customizing. Hold on and enjoy the process.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747923100214/d86fca18-e540-4844-9f26-5253ef5b04b8.png" alt="Raspberry Pi Imager dialog box offering to apply OS customisation settings with options to edit, clear, accept, or decline." class="image--center mx-auto" width="1345" height="897" loading="lazy"></p>
<h4 id="heading-after-a-successful-installation-into-the-disk-remove-your-sd-card">After a successful installation into the disk, remove your SD Card.</h4>
<p>You will receive a successful popup like the one shown below. This demonstrates that all processes were completed successfully, and the Raspberry Pi OS is now installed.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747926095493/ed017dc6-e3a5-4cda-8b3c-6f6a2d74c1ac.png" alt="A notification on Raspberry Pi Imager v1.8.5 shows that Raspberry Pi OS (64-bit) has been successfully written to a mass storage device USB. It instructs to remove the SD card and has a &quot;Continue&quot; button." class="image--center mx-auto" width="1352" height="998" loading="lazy"></p>
<h2 id="heading-how-to-boot-the-raspberry-pi">How to Boot the Raspberry Pi</h2>
<h3 id="heading-eject-the-microsd-safely-from-your-computer"><strong>Eject the MicroSD safely from your computer</strong></h3>
<p>Once the installation is successful, eject the MicroSD safely from the computer.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747926401040/a37dafbb-68ae-4884-9ffe-3c374e6b62b9.jpeg" alt="The Raspberry Pi Board with a micro SD card slot is placed on a wooden surface. A SanDisk 128 GB micro SD card lies next to it." class="image--center mx-auto" width="768" height="1020" loading="lazy"></p>
<h3 id="heading-insert-it-upside-down-into-the-microsd-card-slot-of-your-raspberry-pi">Insert it “upside down” into the MicroSD card slot of your Raspberry Pi</h3>
<p>To properly insert the MicroSD card, place it gently into the slot with the back or gold side facing upward. It will protrude slightly once it is inserted. You are good to go!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747926384277/f7a0c5e9-6a13-4cd2-b94a-65b329a08a5c.jpeg" alt="A Raspberry Pi single-board computer placed on a gray surface, displaying various ports and components including USB ports and an HDMI connector." class="image--center mx-auto" width="768" height="1020" loading="lazy"></p>
<h3 id="heading-connect-the-usb-c-port-of-your-raspberry-pi-to-your-computer-give-the-raspberry-pi-some-time-to-load">Connect the USB-C port of your Raspberry Pi to your computer. Give the Raspberry Pi some time to load</h3>
<p>Get a USB-C cable and connect one end to your Raspberry Pi's USB-C port and the other to a laptop port. It should light up red, indicating that there is an adequate power source. You may also power your Raspberry Pi directly by plugging into a wall socket.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747926452530/b023abe6-5555-4d61-ab99-0d8e36a828a4.jpeg" alt="A Raspberry Pi connected to a laptop via a USB cable on a wooden surface." class="image--center mx-auto" width="768" height="1020" loading="lazy"></p>
<p>After a while, the memory card should begin to boot into the Raspberry Pi, and the green LED will blink for a while. In the next section, we’ll talk about the different states of the two LEDs during and after a successful boot.</p>
<h2 id="heading-understanding-the-led-status-of-the-raspberry-pi-during-setup">Understanding the LED Status of the Raspberry Pi During Setup</h2>
<p>The below table describes the LED statuses you might see when you power on your Raspberry Pi and the SD Card is in the slot.</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>LED Color</strong></td><td><strong>State/Pattern</strong></td><td><strong>Meaning/Recommendation</strong></td></tr>
</thead>
<tbody>
<tr>
<td>🔴Red</td><td>Solid (ON)</td><td>Stable and sufficient power supply</td></tr>
<tr>
<td>🔴Red</td><td>Off or Blinking</td><td>Undervoltage detected (Use a direct phone Charger connected to a Socket)</td></tr>
<tr>
<td>🟢Green</td><td>Blinking (Irregular Pattern)</td><td>SD Card is being read/written (normal booting activity)</td></tr>
<tr>
<td>🟢Green</td><td>Solid (ON)</td><td>Raspberry Pi is stuck or trying to boot.</td></tr>
<tr>
<td>🟢Green</td><td>Off</td><td>No SD Card detected or boot completed</td></tr>
<tr>
<td>🟢Green</td><td>Repeated blink patterns (for example 4 long, 4 short)</td><td>Error code indicating firmware issues.</td></tr>
<tr>
<td>🟢Green</td><td>Constant Blinking</td><td>Normal activity (Raspbian OS is loading and running smoothly)</td></tr>
</tbody>
</table>
</div><h2 id="heading-how-to-establish-an-ssh-connection">How to Establish an SSH Connection</h2>
<p>The SSH (Secure Shell) connection is a network protocol that allows two computers to safely communicate without leaking any information. It’s also used for remote command line execution and for file transfers between two computers.</p>
<p>To establish an SSH connection, you’ll have to complete a few steps. Then I’ll explain how to enable SSH using a Visual Studio Code extension</p>
<h3 id="heading-create-a-wpasupplicantconftxt-in-the-same-folder-of-your-raspberry-pi-sd-card"><strong>Create a</strong> <code>wpa_supplicant.conf.txt</code> <strong>in the same folder of your Raspberry Pi SD Card</strong></h3>
<p>Insert your MicroSD card back into the computer. Then the files that comprise the Raspberry Pi OS will appear on your computer. Create a new text (.txt) document on your computer, similar to the image below, under the SD Card storage section.</p>
<p>Add the code below, making sure that "ssid" is the name of your Wi-Fi network and "psk" is your network's password.</p>
<pre><code class="lang-plaintext">country=NG # Your 2-digit country code
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
    ssid="Josiah"
    psk="roboticsai"
    key_mgmt=WPA-PSK
}
</code></pre>
<h3 id="heading-save-the-file-on-the-same-sd-card"><strong>Save the file on the same SD Card</strong></h3>
<p>Once you've finished producing the text file, save it to the SD Card storage, as shown in the image below.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747928812199/fb766a84-7750-468d-ae78-1ff3c688a52b.jpeg" alt="Screenshot of a file explorer window showing contents of the &quot;bootfs (D:)&quot; directory. Various system and configuration files are listed, including kernel images and .elf files. The selected file is &quot;wpa_supplicant.conf.txt&quot;." class="image--center mx-auto" width="540" height="960" loading="lazy"></p>
<h3 id="heading-create-a-ssh-folder"><strong>Create a .ssh folder</strong></h3>
<p>In your personal computer, create a <code>.ssh</code> folder if it doesn’t exist on your personal computer.</p>
<p>If it exists, the <code>.ssh</code> folder should contain files like <code>id_rsa</code>, <code>known_hosts</code>, and <code>config</code> files. It shouldn’t be empty.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747928560247/d07f8cb9-ec22-47ff-a2a5-d18b614e9985.png" alt="A computer file explorer window showing a list of folders in the &quot;JOSIAH&quot; directory. The folder names include &quot;.matplotlib,&quot; &quot;.mchp_cm,&quot; &quot;.ssh,&quot; and others, with details like date modified and type. The &quot;.ssh&quot; folder is highlighted." class="image--center mx-auto" width="1919" height="977" loading="lazy"></p>
<p>After a successful boot, open your terminal or command line application on your personal computer.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747928958812/2c198297-08a5-4781-9a6a-45fd6c7e85d3.png" alt="Command Prompt window showing &quot;Microsoft Windows [Version 10.0.26100.3915]&quot; and the prompt at &quot;C:sersOSIAH>&quot;." class="image--center mx-auto" width="1731" height="923" loading="lazy"></p>
<p>Make sure that the Raspberry Pi is connected to the same network before moving ahead. Once your wifi or mobile hotspot is switched on, make sure it’s the same password as the <code>wpa_supplicant.conf.txt</code> and the settings page while installing the Raspberry Pi.</p>
<p>As long as the SD card is in the Raspberry Pi and there is adequate power supply for at least 2-5 minutes, the Raspberry Pi will get connected to the wifi or your mobile hotspot.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747931364223/13947f34-c1a9-4b1c-b020-c236b4d377af.jpeg" alt="Screenshot of connected devices interface showing a limit of 3 devices. Two devices are listed: &quot;raspberrypi&quot; with MAC address d8:3a:dd:43:27:71, and &quot;Josiah&quot; with MAC address dc:71:96:d0:d5:4a. A blocklist option is available for viewing devices not allowed to connect." class="image--center mx-auto" width="720" height="825" loading="lazy"></p>
<h3 id="heading-how-to-resolve-connection-problems">How to Resolve Connection Problems</h3>
<p>If there is no connection, reinstall the Raspberry Pi OS Imager on the SD Card again. Then you can also change the network AP Band from 5GHz to 2.5GHz or vice-versa. This can be very tricky.</p>
<p>It should get connected after trying this. Just make sure that the passwords are consistent and that you don’t accidentally have the caps lock key switched on while typing, for example.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1748028008935/192fb282-93c7-4b65-86a2-c26cdfac9d53.jpeg" alt="Screenshot of a portable hotspot setup screen showing fields for network name, password, security setting (WPA2-Personal), AP band selection (5 GHz), and an option to hide the SSID, which is off." class="image--center mx-auto" width="720" height="914" loading="lazy"></p>
<p>To confirm if the Raspberry Pi is connected using the command line interface, use the <code>ping</code> command – it shows the devices connected to the device.</p>
<pre><code class="lang-bash">ping raspberrypi.local
</code></pre>
<p>After running the above command, you should see an image showing the connection once it’s successful like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747931544791/77217325-4f3e-4abb-a136-d4634b773f2d.png" alt="A command prompt window showing a ping test to &quot;raspberrypi.local&quot; with an IPv6 address. Four packets are sent and received with no loss. Round trip times range from 6ms to 125ms, with an average of 36ms." class="image--center mx-auto" width="925" height="382" loading="lazy"></p>
<p>For establishing an SSH connection using the terminal, run the code below:</p>
<pre><code class="lang-bash">ssh pi@raspberrypi.local
</code></pre>
<p>This will result in a request for a password. If it shows an error like the image below, it means you have to delete the <code>known_hosts.old</code> and <code>known_hosts</code> if either or both exist in the <code>.ssh</code> folder in your PC. This is because the keys are conflicting with each other. Then re-run the above code <code>ssh pi@raspberrypi.local</code> in your terminal.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747931933273/d8f111cc-3455-4de3-af0c-cf0a9814a877.png" alt="SSH warning message indicating a change in the remote host identification for a Raspberry Pi, suggesting possible eavesdropping or a host key update. Offers instructions for resolving the issue by updating the known_hosts file." class="image--center mx-auto" width="912" height="489" loading="lazy"></p>
<p>After successful entry, type “<code>yes</code>” in the terminal.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747932392301/a09ad065-8e1e-464f-baef-5529eee26ce4.png" alt="Command-line interface showing an SSH connection attempt to a Raspberry Pi. It prompts the user to confirm the authenticity of the host with a given key fingerprint, asking if they want to continue connecting." class="image--center mx-auto" width="1392" height="281" loading="lazy"></p>
<p><code>Connection Closed</code> should show when the connection is successful.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747932449402/bcd16bc6-18a1-4a84-82cf-d5c7431345e3.png" alt="Screenshot of a terminal window showing an SSH connection attempt from a user to a Raspberry Pi. The authenticity of the host is questioned, asking for confirmation to continue. The fingerprint is displayed, indicating it's not previously known. The connection is then added to known hosts, before closing." class="image--center mx-auto" width="1501" height="345" loading="lazy"></p>
<h2 id="heading-how-to-set-up-visual-studio-code-for-remote-development">How to Set Up Visual Studio Code for Remote Development</h2>
<p>Download and install <a target="_blank" href="https://code.visualstudio.com/">Visual Studio Code</a> if you don’t have it already.</p>
<p>Then, click on the VS Code extension and search for <code>Remote - SSH</code> by Microsoft and install it to your machine.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747933199343/2c181e3a-80bd-44d1-8b40-5e3cf6191f2b.png" alt="Screenshot of the Visual Studio Code extension marketplace displaying the &quot;Remote - SSH&quot; extension by Microsoft. It shows installation details, ratings, and features like using a remote machine with SSH for development. The left sidebar lists related extensions." class="image--center mx-auto" width="1919" height="888" loading="lazy"></p>
<p>Next, click on the “Remote Explorer” icon that looks like a monitor. Select the SSH config in your <code>C:\Users\{name}\.ssh\config</code> folder.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747933364169/7eaa4a7b-294c-41ef-8ecb-fe80151e6399.png" alt="Screenshot of Visual Studio Code showing the Remote - SSH extension interface. The SSH configuration file selection is open, displaying file paths. On the right, there is a description and installation details for the extension, including version and update information. The left sidebar displays a connection to a remote SSH machine named &quot;raspberrypi&quot;." class="image--center mx-auto" width="1918" height="781" loading="lazy"></p>
<p>Make sure the config has this command:</p>
<pre><code class="lang-bash">Host raspberrypi.local
    HostName raspberrypi.local
    User pi
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747933533204/611b6a3d-cd4c-4756-982b-76efb0aa25c9.png" alt="611b6a3d-cd4c-4756-982b-76efb0aa25c9" class="image--center mx-auto" width="916" height="500" loading="lazy"></p>
<p>Enter your username as <code>raspberrypi.local</code> and input your password – the same as the password during loading Raspbian OS.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747933839359/7f43b231-5177-4b11-9d10-7234961db3f7.png" alt="Visual Studio Code interface showing a prompt to enter a password for &quot;pi@raspberrypi.local&quot; to set up an SSH host. The background features a shortcut guide and a loading bar." class="image--center mx-auto" width="1530" height="1002" loading="lazy"></p>
<p>After inputting the correct password, it should start downloading the server.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747933859344/0c87fd5c-071b-4016-b113-4fc88c166032.png" alt="Visual Studio Code interface showing keyboard shortcuts for various commands. A download progress bar at the bottom indicates &quot;Downloading VS Code Server…&quot;" class="image--center mx-auto" width="1526" height="988" loading="lazy"></p>
<p>Congratulations! The image below has a blue rectangle button showing <code>SSH:raspberrypi.local</code> which shows a successful SSH Connection through Visual Studio Code. This also means you can start remote development as we discussed earlier in this tutorial.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747933925369/a2aaf412-e465-47e9-8e97-129734f87534.png" alt="A screenshot of Visual Studio Code's welcome screen. The interface lists options to open a folder or clone a repository. The &quot;Start&quot; section has options like &quot;New File&quot; and &quot;Open Folder.&quot; The &quot;Recent&quot; section displays a list of recently accessed projects. The &quot;Walkthroughs&quot; area suggests getting started guides. The sidebar on the left shows file explorer and other icons. The bottom status bar indicates an SSH connection." class="image--center mx-auto" width="1919" height="1006" loading="lazy"></p>
<h2 id="heading-how-to-write-and-run-the-code-remotely">How to Write and Run the Code Remotely</h2>
<p>Create a new file on your VS Code. This way, you’re creating files and writing to them directly. Go to the terminal and type the commands to create a folder and a file:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747934210225/a6e7f454-6f65-4a87-8692-cadaa642b007.png" alt="Screenshot of Visual Studio Code showing a terminal session and a text editor. The terminal is open at the bottom, with commands for creating a directory, navigating to it, and opening it in the editor. The main editor area prompts to select a language or open a different editor. The Explorer sidebar is visible on the left." class="image--center mx-auto" width="1916" height="880" loading="lazy"></p>
<h3 id="heading-create-a-new-file-and-write-in-your-code"><strong>Create a new file and write in your code</strong></h3>
<p>Create a new file and name it <code>led.py</code> on your Visual Studio Code. It should be in the same folder as <code>test-raspberry</code> on the Raspberry Pi remote network through the SSH connection on VSCode.</p>
<p>Once you have your file created, you can write in your code such as blinking LED to a Raspberry Pi, as you can see in the code below:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> gpiozero <span class="hljs-keyword">import</span> LED
<span class="hljs-keyword">from</span> time <span class="hljs-keyword">import</span> sleep

<span class="hljs-comment"># Set the GPIO pin where the LED is connected</span>
led = LED(<span class="hljs-number">17</span>)  <span class="hljs-comment"># Replace 17 with your GPIO pin number</span>

<span class="hljs-comment"># Blink the LED in a loop</span>
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
    led.on()        <span class="hljs-comment"># Turn LED on</span>
    sleep(<span class="hljs-number">1</span>)        <span class="hljs-comment"># Wait for 1 second</span>
    led.off()       <span class="hljs-comment"># Turn LED off</span>
    sleep(<span class="hljs-number">1</span>)        <span class="hljs-comment"># Wait for 1 second</span>
</code></pre>
<p>After writing this code in the new file you’ve created, run the code by typing the command below in your terminal:</p>
<pre><code class="lang-bash">python led.py
</code></pre>
<p>As soon as this command is sent, the LED positive terminal is connected to the GPIO 17 according to the code and the negative terminal is connected to the GND GPIO pin of the Raspberry Pi. The image from <a target="_blank" href="https://randomnerdtutorials.com/raspberry-pi-pinout-gpios/">Random Nerd Tutorials</a> below shows the GPIO pins and their number to understand the connection. Just note that the connection of the LED is beyond the scope of this tutorial.</p>
<p><img src="https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2023/03/Raspberry-Pi-Pinout-Random-Nerd-Tutorials.png?quality=100&amp;strip=all&amp;ssl=1" alt="Raspberry Pi Pinout Guide: How to use the Raspberry Pi GPIOs? | Random Nerd  Tutorials" width="1280" height="720" loading="lazy"></p>
<p>The LED should start blinking each second according to the code. With this, you can now control your Raspberry Pi (a tiny computer) with another computer (your personal computer) through an SSH connection on Visual Studio Code.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this tutorial, you went through the whole process of setting up a headless Raspberry Pi for remote development using VS Code.</p>
<p>This offers a wide range of benefits: there’s no need for external peripherals, it provides remote access from anywhere within your network, and it leverages efficient coding and debugging with VS Code integration.</p>
<p>You can use this to deploy web servers and IoT dashboards, and you can explore with automating processes using Python scripts and GPIO control.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
