{"id":4974,"date":"2026-08-30T01:10:37","date_gmt":"2026-08-29T16:10:37","guid":{"rendered":"https:\/\/donguri3.net\/server-tech\/raspberry-pi-pico-thonny-led-blinking-2\/"},"modified":"2026-08-30T01:10:39","modified_gmt":"2026-08-29T16:10:39","slug":"raspberry-pi-pico-thonny-led-blinking","status":"publish","type":"post","link":"https:\/\/donguri3.net\/en\/diy-repair\/electronics-microcontroller\/raspberry-pi-pico-thonny-led-blinking\/","title":{"rendered":"How to Blink an LED Using Thonny and a Raspberry Pi Pico Compatible Board"},"content":{"rendered":"<p>In this guide, we will walk you through how to blink the onboard LED on a Raspberry Pi Pico compatible board using Thonny, a Python IDE. To make it easy for beginners, we will explain the entire process step-by-step, from initial setup to running the program.<\/p>\n<h2>What You Need<\/h2>\n<ul>\n<li><strong>Raspberry Pi Pico Compatible Board<\/strong><br \/>The Pico board itself with an onboard LED (typically connected to GPIO25)<br \/>\n<a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/LED-GPIO-25-1.png\"><img decoding=\"async\" class=\"aligncenter wp-image-886 size-full\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/LED-GPIO-25-1.png\" alt=\"Pico-clone pinout\" width=\"1024\" height=\"768\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/LED-GPIO-25-1.png 1024w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/LED-GPIO-25-1-300x225.png 300w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/LED-GPIO-25-1-768x576.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/li>\n<li><strong>PC<\/strong><br \/>A computer equipped with a USB port<\/li>\n<li><strong>Thonny App<\/strong><br \/>An integrated development environment for Python. Download the latest version from the <a href=\"https:\/\/thonny.org\/\">official website<\/a>.<\/li>\n<\/ul>\n<h2>Steps<\/h2>\n<h3>Initial Setup of Thonny<\/h3>\n<ul>\n<li>When you launch Thonny for the first time, the initial settings screen will appear.<\/li>\n<li>Here, select the <strong>&#8220;standard&#8221; mode instead of &#8220;Raspberry Pi (simple)&#8221;<\/strong>.<br \/>*Selecting standard mode makes it easier to use extensions such as MicroPython.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/7e1560f2a9fd2dde4a6280842d79e533.png\"><img decoding=\"async\" class=\"aligncenter wp-image-850 size-full\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/7e1560f2a9fd2dde4a6280842d79e533.png\" alt=\"Thonny First Launch\" width=\"545\" height=\"292\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/7e1560f2a9fd2dde4a6280842d79e533.png 545w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/7e1560f2a9fd2dde4a6280842d79e533-300x161.png 300w\" sizes=\"(max-width: 545px) 100vw, 545px\" \/><\/a><\/p>\n<h3>2. Connecting the Pico to the PC<\/h3>\n<ul>\n<li>Connect the Pico to your PC&#8217;s USB port <strong>while holding down the BOOTSEL button<\/strong>.<br \/>*Connecting while holding the boot button starts the device in bootloader mode, allowing you to flash the firmware.<\/li>\n<\/ul>\n<h3>3. Installing MicroPython via Thonny<\/h3>\n<ul>\n<li>Click on the bottom-right corner of the Thonny window and select &#8220;Install MicroPython&#8221;.<\/li>\n<li>From the displayed list, choose the following settings:\n<ul>\n<li><strong>MicroPython family:<\/strong> RP2<\/li>\n<li><strong>Variant:<\/strong> Raspberry Pi \u00b7 Pico \/ Pico H<\/li>\n<li><strong>Version:<\/strong> 1.24.1 (*Generally, selecting the latest version is fine)<\/li>\n<\/ul>\n<\/li>\n<li>Once the installation is complete, the board with MicroPython installed will be displayed in the bottom right of the Thonny window, confirming a successful connection.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/0f77bdbaa73f5f097a571916a34dec10.png\"><img decoding=\"async\" class=\"aligncenter wp-image-851 size-large\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/0f77bdbaa73f5f097a571916a34dec10-1024x595.png\" alt=\"Installing Bootloader in Thonny\" width=\"1024\" height=\"595\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/0f77bdbaa73f5f097a571916a34dec10-1024x595.png 1024w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/0f77bdbaa73f5f097a571916a34dec10-300x174.png 300w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/0f77bdbaa73f5f097a571916a34dec10-768x446.png 768w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/0f77bdbaa73f5f097a571916a34dec10.png 1261w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h3>4. Creating a New Script File<\/h3>\n<ul>\n<li>In the device tree for <strong>Raspberry Pi Pico<\/strong> displayed on the left side of Thonny, right-click and select &#8220;New file&#8221;.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/2c3cee5e2d20670f26134e68e78a041e.png\"><img decoding=\"async\" class=\"aligncenter wp-image-852 size-full\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/2c3cee5e2d20670f26134e68e78a041e.png\" alt=\"Thonny Operation\" width=\"802\" height=\"702\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/2c3cee5e2d20670f26134e68e78a041e.png 802w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/2c3cee5e2d20670f26134e68e78a041e-300x263.png 300w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/2c3cee5e2d20670f26134e68e78a041e-768x672.png 768w\" sizes=\"(max-width: 802px) 100vw, 802px\" \/><\/a><\/p>\n<ul>\n<li>Name the new file &#8220;main.py&#8221;.<br \/>*Since the Pico automatically reads main.py upon startup, any program written here will run automatically.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/059f03456ca90ec7c1ea71c4e41ad759.png\"><img decoding=\"async\" class=\"aligncenter wp-image-853 size-full\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/059f03456ca90ec7c1ea71c4e41ad759.png\" alt=\"File Name in Thonny\" width=\"802\" height=\"702\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/059f03456ca90ec7c1ea71c4e41ad759.png 802w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/059f03456ca90ec7c1ea71c4e41ad759-300x263.png 300w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/059f03456ca90ec7c1ea71c4e41ad759-768x672.png 768w\" sizes=\"(max-width: 802px) 100vw, 802px\" \/><\/a><\/p>\n<h3>5. Writing Code in main.py<\/h3>\n<p>Enter the following code into the newly created main.py file.<\/p>\n<pre>import time\nfrom machine import Pin\nled = Pin(25, Pin.OUT)\nwhile True:\n    led.value(1)\n    time.sleep_ms(500)\n    led.value(0)\n    time.sleep_ms(500)<\/pre>\n<p>This is a simple program that repeatedly turns the onboard LED on and off every 500 milliseconds.<\/p>\n<h3>6. Verifying Script Operation<\/h3>\n<ul>\n<li>Click the <strong>Run button<\/strong> at the top of Thonny to check if the current script works correctly.<br \/>*If the LED blinks regularly, it&#8217;s a success.<\/li>\n<\/ul>\n<h3>7. Saving the Program to the Board and Auto-Execution<\/h3>\n<ul>\n<li>Once you confirm it works properly, <strong>save main.py onto the board<\/strong>.<\/li>\n<li>Next, press the Pico&#8217;s <strong>reset button<\/strong> to reboot the board. This will automatically load the saved main.py and launch the LED blinking program.<br \/>\n<a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918.jpg\"><img decoding=\"async\" class=\"aligncenter wp-image-887 size-large\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918-1024x768.jpg\" alt=\"Pico LED blinking\" width=\"1024\" height=\"768\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918-1024x768.jpg 1024w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918-300x225.jpg 300w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918-768x576.jpg 768w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918-1536x1152.jpg 1536w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918-2048x1536.jpg 2048w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918-530x398.jpg 530w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918-565x424.jpg 565w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918-710x533.jpg 710w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918-725x544.jpg 725w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/03\/IMG_15821-scaled-e1741661878918.jpg 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/li>\n<\/ul>\n<h2>Summary<\/h2>\n<p>Through the steps above, we have gone through the entire process of setting up the MicroPython environment and executing an LED blinking program using Thonny and a Raspberry Pi Pico compatible board.<\/p>\n<ul>\n<li>Important notes on Thonny settings during the first launch<\/li>\n<li>How to connect the Pico in boot mode<\/li>\n<li>MicroPython installation and configuration<\/li>\n<li>Steps for creating main.py and running the code<\/li>\n<\/ul>\n<p>By practicing these steps, you can learn the fundamentals of development using MicroPython while experiencing the joy of interacting with actual hardware. Be sure to try out other projects as well!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we will walk you through how to blink the onboard LED on a Raspberry Pi Pico compatible board u [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":887,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"https:\/\/donguri3.net\/?p=849","footnotes":""},"categories":[1163],"tags":[267,265,47,277,272,275,303,104],"class_list":["post-4974","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electronics-microcontroller","tag-led","tag-micropython","tag-python","tag-raspberry-pi-pico","tag-thonny","tag-275","tag-303","tag-104","en-US"],"_links":{"self":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/4974","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/comments?post=4974"}],"version-history":[{"count":1,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/4974\/revisions"}],"predecessor-version":[{"id":4977,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/4974\/revisions\/4977"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/media\/887"}],"wp:attachment":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/media?parent=4974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/categories?post=4974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/tags?post=4974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}