<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Steve D&#039;Agostino, Author at Be on the Right Side of Change</title>
	<atom:link href="https://blog.finxter.com/author/steveagostino/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.finxter.com/author/steveagostino/</link>
	<description></description>
	<lastBuildDate>Sun, 20 Nov 2022 10:43:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://blog.finxter.com/wp-content/uploads/2020/08/cropped-cropped-finxter_nobackground-32x32.png</url>
	<title>Steve D&#039;Agostino, Author at Be on the Right Side of Change</title>
	<link>https://blog.finxter.com/author/steveagostino/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Getting To Know Your Basic UCTRONICS Raspberry Pi Pico Kit</title>
		<link>https://blog.finxter.com/getting-to-know-your-basic-uctronics-raspberry-pi-pico-kit/</link>
		
		<dc:creator><![CDATA[Steve D'Agostino]]></dc:creator>
		<pubDate>Mon, 14 Nov 2022 19:21:14 +0000</pubDate>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=892909</guid>

					<description><![CDATA[<p>Now that we’ve covered Thonny and MicroPython, it’s time to get to know the components in your basic Raspberry Pi Pico kit. 🤖 Note: There is more than one kit out there, but it is this author’s opinion that the best value for beginners is the one from UCTRONICS. Most of them have similar components, ... <a title="Getting To Know Your Basic UCTRONICS Raspberry Pi Pico Kit" class="read-more" href="https://blog.finxter.com/getting-to-know-your-basic-uctronics-raspberry-pi-pico-kit/" aria-label="Read more about Getting To Know Your Basic UCTRONICS Raspberry Pi Pico Kit">Read more</a></p>
<p>The post <a href="https://blog.finxter.com/getting-to-know-your-basic-uctronics-raspberry-pi-pico-kit/">Getting To Know Your Basic UCTRONICS Raspberry Pi Pico Kit</a> appeared first on <a href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Now that we’ve covered <a href="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/" data-type="post" data-id="802754" target="_blank" rel="noreferrer noopener">Thonny</a> and <a href="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/" data-type="post" data-id="852391" target="_blank" rel="noreferrer noopener">MicroPython</a>, it’s time to get to know the components in your basic <strong>Raspberry Pi Pico kit</strong>. </p>



<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f916.png" alt="🤖" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Note</strong>: There is more than one kit out there, but it is this author’s opinion that the best value for beginners is the one from UCTRONICS. Most of them have similar components, but this one just happens to be my go-to and is the subject of this installment.</p>



<p><em>*If you have not yet read our previous installments on <a href="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/" data-type="URL" data-id="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/" target="_blank" rel="noreferrer noopener">learning MicroPython</a> for the Raspberry Pi Pico or <a href="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/" data-type="post" data-id="802754" target="_blank" rel="noreferrer noopener">Thonny</a>, be sure you review those before moving beyond this short tutorial.</em></p>



<p>Alright, let’s jump in! Here’s what the kit looks like:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img fetchpriority="high" decoding="async" width="769" height="739" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-139.png" alt="" class="wp-image-892918" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-139.png 769w, https://blog.finxter.com/wp-content/uploads/2022/11/image-139-300x288.png 300w" sizes="(max-width: 769px) 100vw, 769px" /><figcaption class="wp-element-caption"><a href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank" rel="noreferrer noopener">source</a></figcaption></figure>
</div>


<p>First things first, though. We’re going to start with the Pico itself. The main thing you’ll need to know about it (at least for the purposes of doing experiments) is its pins.</p>



<h2 class="wp-block-heading">Your Pico and Its Pins</h2>



<p>Your Pico talks to hardware through a series of pins along both its edges. Most of these pins work as a general-purpose input/output (GPIO) pin, meaning they can be programmed to act as either an input or an output and have no fixed purpose of their own. </p>



<ul class="wp-block-list">
<li>Some pins have extra features and alternative modes for communicating with more complicated hardware; </li>



<li>Others have a fixed purpose, providing connections for things like power.</li>
</ul>



<p>Raspberry Pi Pico’s 40 pins are labeled on the underside of the board, with three also labeled with their numbers on the top of the board: Pin 1, Pin 2, and Pin 39. </p>



<p>These top labels help you remember how the numbering works: Pin 1 is at the top left as you look at the board from above with the micro USB port to the upper side, Pin 20 is the bottom left, Pin 21 the bottom right, and Pin 39 one below the top right with the unlabeled Pin 40 above it.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="549" height="561" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-140.png" alt="" class="wp-image-892922" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-140.png 549w, https://blog.finxter.com/wp-content/uploads/2022/11/image-140-294x300.png 294w" sizes="(max-width: 549px) 100vw, 549px" /><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank">source</a></figcaption></figure>
</div>


<p>While you will generally use actual pin numbers when writing your code, we may reference some of them by their functions, as well.</p>



<p>As you can see, there are several different kinds of pins with different functions. Here’s a quick reference guide to help you remember:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="523" height="686" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-141.png" alt="" class="wp-image-892923" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-141.png 523w, https://blog.finxter.com/wp-content/uploads/2022/11/image-141-229x300.png 229w" sizes="(max-width: 523px) 100vw, 523px" /></figure>
</div>


<p>You’ll learn more about these functions in later tutorials as we get into projects. For now, all you need to focus on is the basics. This is not meant to be an exhaustive electronics course. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<h2 class="wp-block-heading">Other Electronic Components</h2>



<p>Obviously, your Pico isn’t the only thing you’re going to need if you’re going to be conducting any experiments. </p>



<p>The other things are the components that your Pico’s pins will be controlling. There are tons of components out there, but the cool thing about this kit is that these are useful regardless of how complicated your projects ultimately get &#8211; and if you have fun with these, I guarantee you’ll start coming up with your own.</p>



<h3 class="wp-block-heading">Breadboard</h3>



<p>Anyway, let’s start with the second most important component (well, besides the micro USB cord that connects the Pico to your computer) &#8211; your <em>breadboard</em>.&nbsp;</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="471" height="224" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-142.png" alt="" class="wp-image-892926" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-142.png 471w, https://blog.finxter.com/wp-content/uploads/2022/11/image-142-300x143.png 300w" sizes="auto, (max-width: 471px) 100vw, 471px" /><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank">source</a></figcaption></figure>
</div>


<p>This little beauty makes life a WHOLE lot easier. This unit eliminates the need for a circuit board and soldering. Instead, you can just shove &#8211; ok, maybe not <em>shove,</em> but insert &#8211; wires and pins into the right spots and remove them as needed to do new projects. Hard to beat that!</p>



<h3 class="wp-block-heading">Jumper Wires</h3>



<p>Next are your <em>jumper wires</em>, which connect components to circuits on your breadboard and take the place of those little “wire trails” you see on circuit boards. </p>



<p>That way, they aren’t permanent and can be moved as you see fit. They can also be used to lengthen wires or pins as needed. </p>



<p>To accomplish this, they come in 3 types &#8211; male-to-male (M2M), male-to-female (M2F), and of course F2F (can you guess?).</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="314" height="302" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-143.png" alt="" class="wp-image-892928" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-143.png 314w, https://blog.finxter.com/wp-content/uploads/2022/11/image-143-300x289.png 300w" sizes="auto, (max-width: 314px) 100vw, 314px" /><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank">source</a></figcaption></figure>
</div>


<h3 class="wp-block-heading">Momentary Switch</h3>



<p>Next up, we have a <em>push-button switch</em>, or <em>momentary switch</em>. This doodad is exactly what it looks like &#8211; a button. </p>



<p>However, in this case, it’s not the same as a <em>latching switch</em>, which stays depressed once you click it. This one only has to be held down to make it keep working.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="273" height="207" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-144.png" alt="" class="wp-image-892929"/><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank">source</a></figcaption></figure>
</div>


<p>Now this one’s going to shock you. It’s called… a <em>light-emitting diode, or LED</em>! I know, I know, you’ve never heard of it, right? <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f602.png" alt="😂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="374" height="105" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-145.png" alt="" class="wp-image-892930" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-145.png 374w, https://blog.finxter.com/wp-content/uploads/2022/11/image-145-300x84.png 300w" sizes="auto, (max-width: 374px) 100vw, 374px" /><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank">source</a></figcaption></figure>
</div>


<p>I don’t think I have to say much of anything about these, but I will make two points. </p>



<ul class="wp-block-list">
<li>First, not all LEDs are going to work with your Pico. 5V and 12V aren’t good, so if you decide to buy more, make sure you keep that in mind. </li>



<li>Second, the two legs are different lengths. The long one is positive, and the short is negative.</li>
</ul>



<p>When we’re running a current through stuff, we can sometimes run the risk of blowing them out, especially the LEDs. So how do we prevent that from happening? </p>



<h3 class="wp-block-heading">Resistor</h3>



<p>With <em>resistors</em>, of course! Now, there are a lot of resistors out there with different stripes on them to tell you the level of resistance they provide in a unit called <em>ohms(𝞨)</em>. I’m not going to get into that kind of detail here because it isn’t necessary for Pico jobs. </p>



<p>Suffice it to say that if you run out of resistors and want more, you’ll be using little 330𝞨 guys.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="427" height="91" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-146.png" alt="" class="wp-image-892934" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-146.png 427w, https://blog.finxter.com/wp-content/uploads/2022/11/image-146-300x64.png 300w" sizes="auto, (max-width: 427px) 100vw, 427px" /><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank">source</a></figcaption></figure>
</div>


<p>Just one little note &#8211; yours might not be the same color, but the stripes will be. The ones I got in my kit are blue, but that doesn’t matter; 330𝞨 is 330𝞨.</p>



<h3 class="wp-block-heading">Piezoelectric Buzzer</h3>



<p>Everyone’s favorite component to play with &#8211; well, as long as you have people in your place to annoy &#8211; is the <em>piezoelectric buzzer</em>. Oh, boy, this one’s fun! It does exactly what its name indicates, and it does it by vibrating two metal plates together when a current is run through it. Heh, heh.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="290" height="172" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-147.png" alt="" class="wp-image-892937"/><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank">source</a></figcaption></figure>
</div>


<p>I’m an avid guitar player, and I LOVE the electric guitar the most. I’m the heaviest of metal heads! Ok, maybe not that heavy. I only clock in at 5’7” and 140lb. Sorry &#8211; if you’re not an American reader, that ain’t big. Martial arts has done me a lot of good in life. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f923.png" alt="🤣" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>Aaaaaaaanyway, there are at least two knobs on an electric guitar &#8211; one for volume, and one for tone. </p>



<h3 class="wp-block-heading">Potentiometer</h3>



<p>These both use <em>potentiometers</em> that can be used either as a <em>variable resistor</em> (with two legs connected) or a <em>voltage divider</em> (with all three wired up). In other words, one hookup controls ohms and the other controls volts. I’ll let you guess which version controls which function on the guitar.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="162" height="264" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-148.png" alt="" class="wp-image-892939"/><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank">source</a></figcaption></figure>
</div>


<h3 class="wp-block-heading">Motion Detector</h3>



<p>Ever tried to break into somebody’s house, but they had one of those pesky motion detectors that lit up the whole property and nearly got you busted? No? I guess that’s just… a friend… <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f633.png" alt="😳" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>Well, you get one of those pesky… I mean… <em>cool </em>motion detectors, too. It’s actually called a <em>passive infrared sensor (PIR)</em>, and it makes things happen when you wave your hand in front of it. Better than a button? You be the judge.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="286" height="236" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-149.png" alt="" class="wp-image-892941"/><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank">source</a></figcaption></figure>
</div>


<h3 class="wp-block-heading">Screen and Display</h3>



<p>Last but not least (I love overused, trite cliches, don’t you?), we have a screen. It’s actually called an <em>inter-integrated circuit</em> or <em>I2C display</em>. It can show all kinds of nifty stuff from text to pictures. There are some fun things to do with this baby!</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="298" height="156" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-150.png" alt="" class="wp-image-892943"/><figcaption class="wp-element-caption"><a rel="noreferrer noopener" href="https://www.uctronics.com/" data-type="URL" data-id="https://www.uctronics.com/" target="_blank">source</a></figcaption></figure>
</div>


<p>Obviously, there are other components you can get like motors, current sensors, reverse-LEDs, and a whole host of things. Some of them require special drivers and such, though, so they wouldn’t be considered basic. For the purposes of this series, we will be focusing on more basic components and projects before graduating to higher-level (and more expensive) experiments.</p>



<h2 class="wp-block-heading">Keep Learning! <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></h2>



<p>Next time, we’ll get into our first project. It’s pretty easy, but it’s fun and totally worth it. I can’t wait to get started, so I’ll talk to you soon. Until then, try some more of the MicroPython I taught you <a href="https://blog.finxter.com/learn-the-basics-of-micropython-part-2/" data-type="post" data-id="867926" target="_blank" rel="noreferrer noopener">before</a>. Happy coding!</p>
<p>The post <a href="https://blog.finxter.com/getting-to-know-your-basic-uctronics-raspberry-pi-pico-kit/">Getting To Know Your Basic UCTRONICS Raspberry Pi Pico Kit</a> appeared first on <a href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MicroPython Basics &#8211; While Loop, Operators, and User Input</title>
		<link>https://blog.finxter.com/learn-the-basics-of-micropython-part-2/</link>
		
		<dc:creator><![CDATA[Steve D'Agostino]]></dc:creator>
		<pubDate>Sat, 05 Nov 2022 11:19:45 +0000</pubDate>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=867926</guid>

					<description><![CDATA[<p>In the last tutorial, we covered some very important topics to get you started with learning MicroPython so you can begin working with your Raspberry Pi Pico. There are still a few things to cover, but soon we will dive into the microcontroller itself and try out some fun projects! Before we get started, recall ... <a title="MicroPython Basics &#8211; While Loop, Operators, and User Input" class="read-more" href="https://blog.finxter.com/learn-the-basics-of-micropython-part-2/" aria-label="Read more about MicroPython Basics &#8211; While Loop, Operators, and User Input">Read more</a></p>
<p>The post <a href="https://blog.finxter.com/learn-the-basics-of-micropython-part-2/">MicroPython Basics &#8211; While Loop, Operators, and User Input</a> appeared first on <a href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="MicroPython Basics – While Loop, Operators, and User Input" width="937" height="527" src="https://www.youtube.com/embed/cbEb6N7bmR4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p>In the last <a rel="noreferrer noopener" href="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/" data-type="URL" data-id="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/" target="_blank">tutorial</a>, we covered some very important topics to get you started with learning MicroPython so you can begin working with your Raspberry Pi Pico. There are still a few things to cover, but <a href="https://blog.finxter.com/getting-to-know-your-basic-uctronics-raspberry-pi-pico-kit/" data-type="URL" data-id="https://blog.finxter.com/getting-to-know-your-basic-uctronics-raspberry-pi-pico-kit/" target="_blank" rel="noreferrer noopener">soon we will dive into the microcontroller itself</a> and try out some fun projects!</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="938" height="938" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-52.png" alt="" class="wp-image-867990" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-52.png 938w, https://blog.finxter.com/wp-content/uploads/2022/11/image-52-300x300.png 300w, https://blog.finxter.com/wp-content/uploads/2022/11/image-52-150x150.png 150w, https://blog.finxter.com/wp-content/uploads/2022/11/image-52-768x768.png 768w" sizes="auto, (max-width: 938px) 100vw, 938px" /></figure>
</div>


<p>Before we get started, recall the <a href="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/" data-type="URL" data-id="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/" target="_blank" rel="noreferrer noopener">last lesson</a>, where we covered some basic syntax, including how to print to the shell, how to group instructions through indentation, and how to write a <code>for</code> loop. </p>



<p>This time, we’re going to go over what’s known as a &#8220;<code>while</code> loop&#8221;, as well as conditionals and comparative operators. Woohoo! Let’s get started!&nbsp;</p>



<h2 class="wp-block-heading">Preparation</h2>



<p>If your file &#8220;<code>Indentation.py</code>&#8221; is not currently open, go to Thonny, and open it from your Raspberry Pi Pico so that we can write in the editor. </p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="764" height="630" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-53.png" alt="" class="wp-image-867993" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-53.png 764w, https://blog.finxter.com/wp-content/uploads/2022/11/image-53-300x247.png 300w" sizes="auto, (max-width: 764px) 100vw, 764px" /></a></figure>
</div>


<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f30d.png" alt="🌍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended Tutorial</strong>: <a href="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/" data-type="URL" data-id="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/" target="_blank" rel="noreferrer noopener">Getting Started With Thonny – The Optimal IDE for the Raspberry Pi Pico</a></p>



<p>You can erase the current <code>for</code> loop and start fresh, but first, let’s try something. </p>



<h2 class="wp-block-heading">A Note on Code Commenting</h2>



<p>Make the current loop inoperable by highlighting the entire code and pressing <code>Command+3</code> on Mac or <code>Control+3</code> on a PC.&nbsp;</p>



<p class="has-global-color-8-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This is what we call <strong><em>&#8220;commenting out&#8221;</em></strong> your code, which basically turns the code off, so it doesn’t work without having to delete it altogether. Toggling code from being commented to uncommented will come in handy later when you start testing which lines of code do and don&#8217;t work. </p>



<p>Comments are also important to keep track of your thoughts and instructions so you can go back and refer to what you were trying to do with specific code as your projects become more complex. </p>



<p>A comment is preceded with a <code>#</code>, which will render anything you write to just be static text. </p>



<p>Ok, now that you understand commenting, let’s go ahead and delete the existing code since we know we aren’t going to need it again.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="377" height="222" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-51.png" alt="" class="wp-image-867940" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-51.png 377w, https://blog.finxter.com/wp-content/uploads/2022/11/image-51-300x177.png 300w" sizes="auto, (max-width: 377px) 100vw, 377px" /></figure>
</div>


<h2 class="wp-block-heading">While Loops</h2>



<p>While loops differ from <code>for</code> loops in that they are designed not to perform instructions a set number of times, but rather while certain conditions are met. </p>



<p>As such, <code>while</code> loops can sometimes result in what we call &#8220;infinite loops&#8221;. If the only condition we want to specify is that our program is to run, then we are creating an infinite loop.</p>



<p>In this case, we will want to make use of the <strong>Stop</strong> icon on the toolbar in <a href="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/" data-type="post" data-id="802754" target="_blank" rel="noreferrer noopener">Thonny</a>. </p>



<p>The way we tell the program to run is simply by stating</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">while True:</pre>



<p>So let’s try an infinite loop that will <a href="https://blog.finxter.com/python-print/" data-type="post" data-id="20731" target="_blank" rel="noreferrer noopener">print</a> <code>"Loop running!"</code> that we will have to use the <strong>Stop</strong> icon to, well, stop! </p>



<p>It should look like this:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">while True:
    print("Loop running!")
</pre>



<p>Pretty simple, right? <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f34e.png" alt="🍎" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </p>



<p>Well, there is one tiny issue. A loop this simple can run too fast and chew up your computer’s resources, so we need to slow it down a bit so as not to overload our processor. </p>



<p>We do this by importing a library called <strong>Utime</strong>. We will get into more detail about libraries as we start programming the Pico in another installment, but for now, let’s just focus on the task at hand. </p>



<p>Go to the very top of your editor (line 1) and type:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import utime</pre>



<p>Then we will add the while loop and include a delay plus another print function to show the loop <a href="https://blog.finxter.com/how-to-stop-a-while-loop-in-python/" data-type="post" data-id="29478" target="_blank" rel="noreferrer noopener">ending</a>:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">while True:
    print("Loop running!")
    utime.sleep(1)
print("Loop finished!")
</pre>



<p>Click the <strong>Run</strong> icon to start the program again, and you’ll see <code>"Loop running!"</code> continuously printing in the shell with a 1 second delay between each print (that’s what’s happening when you use <code>utime</code> to sleep for (1)). </p>



<p>When you click the <strong>Stop</strong> icon, you’re actually interrupting the program, and the MicroPython interpreter will restart. </p>



<p>As a result, you’ll notice that the words <code>"Loop finished!"</code> never end up printing since the loop never ends until you interrupt the program, which stops it from ever getting to the final print instructions. </p>



<p>Womp, womp!</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="941" height="707" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-50.png" alt="" class="wp-image-867939" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-50.png 941w, https://blog.finxter.com/wp-content/uploads/2022/11/image-50-300x225.png 300w, https://blog.finxter.com/wp-content/uploads/2022/11/image-50-768x577.png 768w" sizes="auto, (max-width: 941px) 100vw, 941px" /></figure>
</div>


<h2 class="wp-block-heading">Inputs, Comparison Operators, and Conditionals</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="768" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-54-1024x768.png" alt="" class="wp-image-867996" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-54-1024x768.png 1024w, https://blog.finxter.com/wp-content/uploads/2022/11/image-54-300x225.png 300w, https://blog.finxter.com/wp-content/uploads/2022/11/image-54-768x576.png 768w, https://blog.finxter.com/wp-content/uploads/2022/11/image-54.png 1251w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>Cool! So now that you&#8217;ve written an infinite loop, let’s try another kind of while loop that checks for a certain condition. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>But first, let’s create an input so that we can experiment with making the condition we’re going to use either true or false. </p>



<p>In order to do that, we are going to define a new variable that will be checked for the trueness (or lack thereof) of the condition. For this new experiment, open a new file and save it as &#8220;<code>Name_Test.py</code>&#8221; then on line 1, type:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">user_name = input("What is your name? ")</pre>



<p>Notice there is a space after the question mark and before the closing quotes. </p>



<p>This is simply so that there will be a space between the question and your answer and is a common convention in Python. </p>



<p>Click the <strong>Run</strong> icon, and you’ll see the question appear in the shell, where you can type your answer right next to it. My name is Steve, so I’ll type that and hit <code>Enter</code> or <code>Return</code>.&nbsp;</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="934" height="567" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-49.png" alt="" class="wp-image-867938" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-49.png 934w, https://blog.finxter.com/wp-content/uploads/2022/11/image-49-300x182.png 300w, https://blog.finxter.com/wp-content/uploads/2022/11/image-49-768x466.png 768w" sizes="auto, (max-width: 934px) 100vw, 934px" /></figure>
</div>


<p>Notice nothing happens except you get a new command line in the shell. </p>



<p>That’s because you haven’t told MicroPython what to do with your name input. That’s what the next while loop is going to do. In this loop, we’re going to have a message that will print only if you have a certain name. </p>



<p>If not, then a different message will print and you’ll be re-prompted to input another name.</p>



<p><strong><em>So how do we denote whether a name is equal to or different from the name checked for in the loop? </em></strong></p>



<p>By using what we call <em>comparison operators</em>. The primary <a href="https://blog.finxter.com/python-comparison-operators/" data-type="post" data-id="33245" target="_blank" rel="noreferrer noopener">comparison operators</a> we can use are:</p>



<ul class="wp-block-list">
<li><code>==</code> &#8211; <a href="https://blog.finxter.com/python-equal-to/" data-type="post" data-id="31075" target="_blank" rel="noreferrer noopener">equal to</a></li>



<li><code>!=</code> &#8211; <a href="https://blog.finxter.com/python-not-equal-to/" data-type="post" data-id="31102" target="_blank" rel="noreferrer noopener">not equal to</a></li>



<li><code>&gt;=</code> &#8211; <a href="https://blog.finxter.com/python-greater-than-or-equal-to/" data-type="post" data-id="30888" target="_blank" rel="noreferrer noopener">greater than or equal to</a></li>



<li><code>&lt;=</code> &#8211; <a href="https://blog.finxter.com/python-less-than-or-equal-to/" data-type="post" data-id="30938" target="_blank" rel="noreferrer noopener">less than or equal to</a></li>



<li><code>&gt;</code> &#8211; <a href="https://blog.finxter.com/python-greater-than/" data-type="post" data-id="30762" target="_blank" rel="noreferrer noopener">greater than</a></li>



<li><code>&lt;</code> &#8211; <a href="https://blog.finxter.com/python-less-than/" data-type="post" data-id="30841" target="_blank" rel="noreferrer noopener">less than</a></li>
</ul>



<p>Got it? </p>



<p>So that means that if we want to compare a name to our input, we need to write our loop using either the <code>==</code> or <code>!=</code> operator. </p>



<p>And since we want to print a message and generate a new prompt any time the name doesn’t match, we want our loop to run whenever there is not a match. </p>



<p>But what if there is a match? </p>



<p>Well, we’ll give instructions for that <em>outside</em> of the loop with just a simple print command like before. Let’s use the name <strong><em>Bruce Wayne</em></strong>. </p>



<p>So under your <code>user_name</code> input in the editor write:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">while user_name != "Bruce Wayne":
    print("You’re not Batman! Try again!")
    user_name = input("What is your name? ")
print("You’re Batman!")
</pre>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="938" height="707" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-46.png" alt="" class="wp-image-867935" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-46.png 938w, https://blog.finxter.com/wp-content/uploads/2022/11/image-46-300x226.png 300w, https://blog.finxter.com/wp-content/uploads/2022/11/image-46-768x579.png 768w" sizes="auto, (max-width: 938px) 100vw, 938px" /></figure>
</div>


<p>Nice! That’s pretty much all you need to know about loops for now, but there is one other neat thing we can do with this comparison that will have a similar effect but doesn’t use a loop to check a condition’s trueness. </p>



<h2 class="wp-block-heading">Conditional Statements</h2>



<p>It’s called… yep, you guessed it &#8211; a <strong><em>conditional statement!</em></strong>&nbsp;</p>



<p>These are used all over the place and use the terms &#8220;<code>if</code>&#8221; and &#8220;<code>else</code>&#8220;, returning a result if a condition is met or else returns something different. </p>



<p>In this case, it’s simpler than using the while loop, but the major difference here is that since we are not running a loop, you would have to click the <strong>Run</strong> icon again in order for another input to be considered. </p>



<p>For this example, we will simply write:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">if user_name == "Bruce Wayne":
    print("You’re Batman!")
else:
    print("You’re not Batman!")
</pre>



<p></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="939" height="568" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-47.png" alt="" class="wp-image-867936" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-47.png 939w, https://blog.finxter.com/wp-content/uploads/2022/11/image-47-300x181.png 300w, https://blog.finxter.com/wp-content/uploads/2022/11/image-47-768x465.png 768w" sizes="auto, (max-width: 939px) 100vw, 939px" /></figure>
</div>

<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="935" height="569" src="https://blog.finxter.com/wp-content/uploads/2022/11/image-48.png" alt="" class="wp-image-867937" srcset="https://blog.finxter.com/wp-content/uploads/2022/11/image-48.png 935w, https://blog.finxter.com/wp-content/uploads/2022/11/image-48-300x183.png 300w, https://blog.finxter.com/wp-content/uploads/2022/11/image-48-768x467.png 768w" sizes="auto, (max-width: 935px) 100vw, 935px" /></figure>
</div>


<p>How cool! Try some different loops and conditionals on your own. </p>



<p>In the following tutorial, we’ll start looking at a basic Raspberry Pi Pico kit and its components. Until then, happy coding!</p>



<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f30d.png" alt="🌍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Keep Learning</strong>: <a href="https://blog.finxter.com/getting-to-know-your-basic-uctronics-raspberry-pi-pico-kit/" data-type="post" data-id="892909" target="_blank" rel="noreferrer noopener">Getting To Know Your Basic UCTRONICS Raspberry Pi Pico Kit</a></p>
<p>The post <a href="https://blog.finxter.com/learn-the-basics-of-micropython-part-2/">MicroPython Basics &#8211; While Loop, Operators, and User Input</a> appeared first on <a href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Learn the Basics of MicroPython for Absolute Python Beginners</title>
		<link>https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/</link>
		
		<dc:creator><![CDATA[Steve D'Agostino]]></dc:creator>
		<pubDate>Fri, 04 Nov 2022 10:50:00 +0000</pubDate>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=852391</guid>

					<description><![CDATA[<p>When learning how to program your Raspberry Pi Pico, you need to learn basic concepts of a limited version of the Python programming language known as MicroPython. It’s a great way to learn Python, as it is much simpler than Python, which can be very complicated and take a long time to master. For the ... <a title="Learn the Basics of MicroPython for Absolute Python Beginners" class="read-more" href="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/" aria-label="Read more about Learn the Basics of MicroPython for Absolute Python Beginners">Read more</a></p>
<p>The post <a href="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/">Learn the Basics of MicroPython for Absolute Python Beginners</a> appeared first on <a href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="683" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-286-1024x683.png" alt="" class="wp-image-852426" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-286-1024x683.png 1024w, https://blog.finxter.com/wp-content/uploads/2022/10/image-286-300x200.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-286-768x512.png 768w, https://blog.finxter.com/wp-content/uploads/2022/10/image-286.png 1401w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>When learning how to program your Raspberry Pi Pico, you need to learn basic concepts of a limited version of the Python programming language known as <strong><em>MicroPython</em></strong>. </p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Learn the Basics of MicroPython for Absolute Python Beginners" width="937" height="703" src="https://www.youtube.com/embed/lli5hbY9fGs?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p>It’s a great way to learn Python, as it is much simpler than Python, which can be very complicated and take a long time to master. </p>



<p>For the purposes of using a microcontroller, you only need to know some basics to get started. </p>



<p>Before we jump in, let’s take a quick moment to familiarize you with your Python IDE, <a href="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/" data-type="post" data-id="802754" target="_blank" rel="noreferrer noopener">Thonny</a>.</p>



<h2 class="wp-block-heading">Using Thonny</h2>



<p>To get started, there are three parts of the interface that you should be aware of &#8212; the toolbar, the editor, and the shell.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="688" height="346" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-279.png" alt="" class="wp-image-852393" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-279.png 688w, https://blog.finxter.com/wp-content/uploads/2022/10/image-279-300x151.png 300w" sizes="auto, (max-width: 688px) 100vw, 688px" /></figure>
</div>


<h3 class="wp-block-heading">(1) Toolbar <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1fa9b.png" alt="🪛" class="wp-smiley" style="height: 1em; max-height: 1em;" /></h3>



<p>The <strong>toolbar</strong> has icons that will help you do a few things, such as creating new files, opening existing ones, and saving, just like you see with most programs. </p>



<p>The other things you’ll want to notice are the green button, which will run your programs that you write in the editor and the stop button which will end programs that run forever. </p>



<p>We’ll get into that in the next tutorial.</p>



<h3 class="wp-block-heading">(2) Editor <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4dd.png" alt="📝" class="wp-smiley" style="height: 1em; max-height: 1em;" /></h3>



<p>The <strong>editor</strong> is where you will write your programs that you will save and run by using the run button in the toolbar. You may also see or hear this referred to as the script area, as this is where you write your scripts.</p>



<h3 class="wp-block-heading">(3) Shell <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25fc.png" alt="◼" class="wp-smiley" style="height: 1em; max-height: 1em;" /></h3>



<p>The <strong>Python shell</strong> has two purposes. </p>



<p>You can run individual instructions by hitting the <code>Enter</code> key without having to write them in the editor and run them, but this only really is good for simple instructions. You won’t use it to write complex code.</p>



<p>The second purpose is to provide information about scripts that you have written, including where errors might be in your code. </p>



<p>This is sometimes referred to as <strong><em>REPL</em></strong>, which stands for </p>



<ul class="wp-block-list">
<li><strong>R</strong>ead, </li>



<li><strong>E</strong>valuate, </li>



<li><strong>P</strong>rint, and </li>



<li><strong>L</strong>oop.</li>
</ul>



<p>In the following tutorial and video, I&#8217;ll show you how to get started with the Thonny IDE&#8212;feel free to check it out! <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f30d.png" alt="🌍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended Tutorial</strong>: <a href="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/" data-type="URL" data-id="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/" target="_blank" rel="noreferrer noopener">Getting Started With Thonny – The Optimal IDE for the Raspberry Pi Pico</a></p>



<h2 class="wp-block-heading">Writing Your First Code</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="683" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-287-1024x683.png" alt="" class="wp-image-852427" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-287-1024x683.png 1024w, https://blog.finxter.com/wp-content/uploads/2022/10/image-287-300x200.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-287-768x512.png 768w, https://blog.finxter.com/wp-content/uploads/2022/10/image-287.png 1401w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>Ok, so now that you know the parts of the interface, let’s try some code to get started. </p>



<p>We’ll begin with the universal first program, “Hello, World”. First, we’re going to try it in the shell since it’s only a <a href="https://blog.finxter.com/python-one-line-x/" data-type="post" data-id="10612" target="_blank" rel="noreferrer noopener">one-line</a> command. </p>



<p>Type the following command like so:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">print("Hello, World!")</pre>



<p>The results should be that the words <code>"Hello, World!"</code> print in the shell, but without quotation marks. </p>



<p>This is the syntax we use when we want to print something &#8211; <code><a href="https://blog.finxter.com/python-print/" data-type="post" data-id="20731" target="_blank" rel="noreferrer noopener">print()</a></code>, with whatever you want printed put inside the parentheses. If it’s words, we put them inside quotes.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="941" height="309" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-280.png" alt="" class="wp-image-852413" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-280.png 941w, https://blog.finxter.com/wp-content/uploads/2022/10/image-280-300x99.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-280-768x252.png 768w" sizes="auto, (max-width: 941px) 100vw, 941px" /></figure>
</div>


<p>Now, we’re going to run the program from the editor. </p>



<p>If you want to clear out anything you’ve done in the shell or just start fresh, then click in the shell and press either <code>Command+k</code> on a Mac or <code>Control+k</code> on a PC. </p>



<p>Personally, I like to keep my shell clean and clear when I’m doing something new.</p>



<p>Ok, so now that you’ve cleared the shell (if that’s what you chose to do), type the same command as before into the editor, then click the <code>Save</code> icon. </p>



<p>When prompted to decide where to save the file, choose the <strong>Raspberry Pi Pico</strong> and title your file <code>"Hello_World.py"</code>. Don’t forget to add the <code>".py"</code> to the end, as this is the file extension that denotes a Python file. </p>



<p>We’ll do that with every file we create with Thonny.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="937" height="618" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-281.png" alt="" class="wp-image-852414" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-281.png 937w, https://blog.finxter.com/wp-content/uploads/2022/10/image-281-300x198.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-281-768x507.png 768w" sizes="auto, (max-width: 937px) 100vw, 937px" /></figure>
</div>


<p>Once you’ve saved, click the green <code>Run</code> button in the toolbar, and you’ll see <code>Hello, World!</code> print in the shell as you did before.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="938" height="619" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-282.png" alt="" class="wp-image-852416" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-282.png 938w, https://blog.finxter.com/wp-content/uploads/2022/10/image-282-300x198.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-282-768x507.png 768w" sizes="auto, (max-width: 938px) 100vw, 938px" /></figure>
</div>


<p>There are two things going on here.</p>



<p>First, you are telling Thonny to print something out in the shell, and second, by using quotation marks, you are telling Thonny that what is to be printed is a <em>string </em>of text.</p>



<p>In programming languages like <a href="https://blog.finxter.com/python-crash-course/" data-type="post" data-id="3951" target="_blank" rel="noreferrer noopener">Python</a>, there are what are known as “primitives”, which are basic data types to work with in your programming. </p>



<p>Those data types are:</p>



<ul class="wp-block-list">
<li><strong>Strings</strong> &#8211; just plain ol’ text, like <code>"Hello World"</code></li>



<li><strong>Integers</strong> &#8211; whole numbers, like <code>42</code></li>



<li><strong>Floats</strong> &#8211; numbers with decimals, like <code>3.14</code></li>



<li><strong>Booleans</strong> &#8211; choices between two options, like <code>True</code> or <code>False</code></li>
</ul>



<h2 class="wp-block-heading">Loops and Indentation</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="768" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-288-1024x768.png" alt="" class="wp-image-852431" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-288-1024x768.png 1024w, https://blog.finxter.com/wp-content/uploads/2022/10/image-288-300x225.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-288-768x576.png 768w, https://blog.finxter.com/wp-content/uploads/2022/10/image-288.png 1246w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>Now you&#8217;re going to write your first loop, which is simply a term that refers to a set of instructions to be repeated. </p>



<p>You will be writing those instructions in a specific type of way. The reason for this is that Python programs run from top to bottom, but your interpreter is dumb. </p>



<p>It only knows what you tell it, so the way we give instructions to the Python interpreter is by grouping those instructions with <a href="https://blog.finxter.com/indentationerror-unindent-does-not-match-any-outer-indentation-level-how-to-fix-this-crazy-bug-in-python/" data-type="post" data-id="25874" target="_blank" rel="noreferrer noopener">indentations</a>. </p>



<p>What we’re going to do is tell Thonny to print some text, run a loop, then print more text. When we give the instructions that are to be repeated by the loop, we will indent those instructions so that Thonny will “understand”.</p>



<p>There are two primary loop types, but today, we are only going to focus on what is called a “<code>for</code> loop”, which runs a defined number of times. </p>



<p>First, let’s start a new program by clicking the <code>new file</code> icon (the white piece of paper <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4c3.png" alt="📃" class="wp-smiley" style="height: 1em; max-height: 1em;" />) then writing some code in the editor like so:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">print("Loop starting!")
for i in range(10):
</pre>



<p>Then hit the <code>Enter</code> (PC) or <code>Return</code> (Mac) key.&nbsp;</p>



<p>What you’re doing is assigning a variable, <code>i</code>, for the loop to use as a counter and telling it that <code>i</code> will be every number in the <a href="https://blog.finxter.com/python-range-function/" data-type="post" data-id="18290" target="_blank" rel="noreferrer noopener">range</a> of 10 as the loop is performed. </p>



<p>In other words, the instructions will be repeated 10 times, as defined by the range. </p>



<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Info</strong>: Python is known as a 0-indexed language, which means the default start of the range is 0 rather than 1, so 10 is not included in the range. Therefore, numbers starting with 0 is the range 0-9, so <em>i</em> will be the numbers 0-9 in this example.</p>



<p>The other thing to notice here is the colon <code>:</code> at the end of the line. </p>



<p>That tells Thonny that you are about to give it instructions for the loop you just told it will be performed. When you hit the <code>Enter</code> or <code>Return</code> key, not only will a new line be created, but it will also automatically start at an indented 4 spaces in.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="406" height="284" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-283.png" alt="" class="wp-image-852419" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-283.png 406w, https://blog.finxter.com/wp-content/uploads/2022/10/image-283-300x210.png 300w" sizes="auto, (max-width: 406px) 100vw, 406px" /></figure>
</div>


<p>This is where you’re going to tell Thonny what instructions to repeat. For the sake of this exercise, we’re simply going to print to the shell. </p>



<p>However, this time, we’re going to print both a string and whatever number <code>i</code> happens to be for each repetition of the loop. </p>



<p>So to do that, type&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">print("Loop number", i)</pre>



<p>We need to separate multiple data types being printed on the same line with a comma so that Thonny “knows” that there are separate things to interpret because again, your interpreter only knows what you tell it.</p>



<p>After that, hit <code>Enter</code> or <code>Return</code> for a new line, but this time, hit the <code>backspace</code> key. </p>



<p>We don’t want Thonny to repeat the next instructions, so we need to make sure they are <em>outside</em> of the loop. </p>



<p>Then type&nbsp;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">print("Loop ended!")</pre>



<p>Your whole program will look like this:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="310" height="171" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-284.png" alt="" class="wp-image-852423" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-284.png 310w, https://blog.finxter.com/wp-content/uploads/2022/10/image-284-300x165.png 300w" sizes="auto, (max-width: 310px) 100vw, 310px" /></figure>
</div>


<p>Here for copy&amp;paste:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">print("Loop starting!")
for i in range(10):
    print("Loop number", i)
print("Loop ended!")</pre>



<p>Now go to the toolbar and click the <code>save</code> button. We’re going to call this “<code>Indentation.py</code>”. Once saved, click the green <code>Run</code> button, and you’ll see the results:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="942" height="712" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-285.png" alt="" class="wp-image-852425" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-285.png 942w, https://blog.finxter.com/wp-content/uploads/2022/10/image-285-300x227.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-285-768x580.png 768w" sizes="auto, (max-width: 942px) 100vw, 942px" /></figure>
</div>


<p>Ok, I think that’s enough for today. Try changing the range from 10 by adding a start and stop number like this:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">for i in range(x, y):</pre>



<p>With <code>x</code> and <code>y</code> being whatever numbers you choose. </p>



<p>For example, if you use <code><a href="https://blog.finxter.com/python-range-function/" data-type="post" data-id="18290" target="_blank" rel="noreferrer noopener">range(3, 14)</a></code>, <code>i</code> will print as the numbers 3-13, since the last number is never included in the loop. If you want to print 1-10 instead of 0-9, you should use <code>range(1, 11)</code> and so on.</p>



<h2 class="wp-block-heading">Thanks for Reading!</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="683" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-289-1024x683.png" alt="" class="wp-image-852436" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-289-1024x683.png 1024w, https://blog.finxter.com/wp-content/uploads/2022/10/image-289-300x200.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-289-768x512.png 768w, https://blog.finxter.com/wp-content/uploads/2022/10/image-289.png 1401w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>Next time, we will try a different kind of loop and explore what are known as “conditionals” that perform actions based on whether certain criteria are met. Until then, happy coding!</p>



<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f30d.png" alt="🌍" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong> Next Tutorial</strong>: <a href="https://blog.finxter.com/learn-the-basics-of-micropython-part-2/" data-type="URL" data-id="https://blog.finxter.com/learn-the-basics-of-micropython-part-2/" target="_blank" rel="noreferrer noopener">Learn Basics of MicroPython &#8211; Part 2</a></p>
<p>The post <a href="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/">Learn the Basics of MicroPython for Absolute Python Beginners</a> appeared first on <a href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Getting Started With Thonny &#8211; The Optimal IDE for the Raspberry Pi Pico</title>
		<link>https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/</link>
		
		<dc:creator><![CDATA[Steve D'Agostino]]></dc:creator>
		<pubDate>Tue, 18 Oct 2022 12:19:39 +0000</pubDate>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=802754</guid>

					<description><![CDATA[<p>So you’ve decided to learn about microcontrollers and programming electronics. That’s great! There is a whole world of fun and exciting things to do in this realm, but for some, it can be a bit overwhelming when first getting started. Fear not &#8211; the newest iteration of microcontrollers from the Raspberry Pi institute is here, ... <a title="Getting Started With Thonny &#8211; The Optimal IDE for the Raspberry Pi Pico" class="read-more" href="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/" aria-label="Read more about Getting Started With Thonny &#8211; The Optimal IDE for the Raspberry Pi Pico">Read more</a></p>
<p>The post <a href="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/">Getting Started With Thonny &#8211; The Optimal IDE for the Raspberry Pi Pico</a> appeared first on <a href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="764" height="630" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-168.png" alt="" class="wp-image-802838" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-168.png 764w, https://blog.finxter.com/wp-content/uploads/2022/10/image-168-300x247.png 300w" sizes="auto, (max-width: 764px) 100vw, 764px" /></figure>
</div>


<p>So you’ve decided to learn about microcontrollers and programming electronics. That’s great! There is a whole world of fun and exciting things to do in this realm, but for some, it can be a bit overwhelming when first getting started.</p>



<p>Fear not &#8211; the newest iteration of microcontrollers from the Raspberry Pi institute is here, and it’s about the size of a stick of gum. Welcome to the Raspberry Pi Pico.&nbsp;</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Getting Started With Thonny - The Optimal IDE for the Raspberry Pi Pico" width="937" height="527" src="https://www.youtube.com/embed/Id8f8byBmE8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<h2 class="wp-block-heading">Basic Pi Knowledge</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="683" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-169-1024x683.png" alt="" class="wp-image-802844" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-169-1024x683.png 1024w, https://blog.finxter.com/wp-content/uploads/2022/10/image-169-300x200.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-169-768x512.png 768w, https://blog.finxter.com/wp-content/uploads/2022/10/image-169.png 1251w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>Before we get started working with the Pico, there are a few things to know. This tutorial is not meant to be an exhaustive lesson on the Pico itself, but there are some different variations that will come in handy to understand as you are getting things set up.</p>



<p>There are<strong> two primary variations</strong> of the Pico, and there are two ways you can receive the processor. The two versions are <strong>wired</strong> and <strong>wireless</strong>, and the two ways they ship are with and without headers pre-soldered onto the board.&nbsp;</p>



<p>The traditional formats are <em>Pico </em>with no headers and <em>Pico H</em> with the headers pre-soldered. The wireless versions are the <em>Pico W</em> and <em>Pico WH</em>. </p>



<p>This is important when we get to selecting and installing the proper Python interpreter for Thonny, the Integrated Development Environment (IDE) used to write the <a href="https://blog.finxter.com/python-crash-course/" data-type="post" data-id="3951" target="_blank" rel="noreferrer noopener">Python code</a> that will control the devices used in your Pico projects.</p>



<p>With that out of the way, let’s jump into Thonny, where you will make all the magic happen!</p>



<h2 class="wp-block-heading">Downloading and Installation on Mac and Windows</h2>



<p>Once you have connected your Pico to your computer, you will need to download the Thonny installer from their website at <a href="https://thonny.org/" target="_blank" rel="noreferrer noopener">https://thonny.org/</a>. </p>



<p>From there, you will see a box on the main page where you can download the package for Windows, Mac, or Linux here:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="667" height="643" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-161.png" alt="" class="wp-image-802782" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-161.png 667w, https://blog.finxter.com/wp-content/uploads/2022/10/image-161-300x289.png 300w" sizes="auto, (max-width: 667px) 100vw, 667px" /></figure>
</div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f427.png" alt="🐧" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Linux</strong>: While there is a download link for Linux, we will focus on Mac and Windows, as the typical beginner is not likely to be on a Linux platform, and there’s no need to add any complexity in this tutorial. </p>



<p>Another thing we will assume here is that you do not currently have Python installed on your computer and that you will use the full installation package with Python included.</p>



<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended Tutorial</strong>: <a href="https://blog.finxter.com/how-to-install-python/" data-type="post" data-id="17770" target="_blank" rel="noreferrer noopener">How to Install Python?</a></p>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f34e.png" alt="🍎" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>MacOS</strong>: First, let’s start with Mac since the process is about as straightforward as it gets. For Mac users, it’s simply a matter of clicking the link to download and then clicking on the downloaded file to initiate the installation. That’s it. Easy-peasy.</p>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1fa9f.png" alt="🪟" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Windows</strong>: With Windows, the process depends partly on what browser you typically use. If you’re using Firefox, Chrome, or some clone thereof, again, it’s generally a simple process. However, if you use Microsoft Internet Explorer, get a new browser (ha!). All kidding aside, if you use IE or Microsoft Edge, you may run into a SmartScreen Filter issue.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="683" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-170-1024x683.png" alt="" class="wp-image-802870" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-170-1024x683.png 1024w, https://blog.finxter.com/wp-content/uploads/2022/10/image-170-300x200.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-170-768x512.png 768w, https://blog.finxter.com/wp-content/uploads/2022/10/image-170.png 1251w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>SmartScreen Filter was introduced with Windows 8 in order to make it more difficult to download and install malware onto your system, and it is known to flag Thonny as “unsafe”. If this happens, there are two ways to move forward.</p>



<p>First, if you see this:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-162.png" alt="" class="wp-image-802789" width="700" height="34" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-162.png 800w, https://blog.finxter.com/wp-content/uploads/2022/10/image-162-300x15.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-162-768x37.png 768w" sizes="auto, (max-width: 700px) 100vw, 700px" /></figure>
</div>


<p>Click “View Downloads”, where you should see a window that looks something like this:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="400" height="433" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-163.png" alt="" class="wp-image-802793" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-163.png 400w, https://blog.finxter.com/wp-content/uploads/2022/10/image-163-277x300.png 277w" sizes="auto, (max-width: 400px) 100vw, 400px" /></figure>
</div>


<p>Simply click on the option that says “Run anyway”, and the installation will proceed. </p>



<p>The other option is to open your Downloads folder and just run the program from there. </p>



<p>If you’re prompted with the question <em>“Do you want to run this file?”</em> or <em>“Are you sure you want to run this file?”</em>, click run, and you’re good to go. This is not an unsafe file, but sometimes, unfamiliar <code>.exe</code> files trigger this response so it’s good to know about it beforehand.</p>



<h2 class="wp-block-heading">Installation of Python Interpreter</h2>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="580" height="164" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-171.png" alt="" class="wp-image-802881" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-171.png 580w, https://blog.finxter.com/wp-content/uploads/2022/10/image-171-300x85.png 300w" sizes="auto, (max-width: 580px) 100vw, 580px" /></figure>
</div>


<p>Now that you have installed Thonny along with Python, you will need to make sure that you are using the correct Python interpreter for your Pico. </p>



<p>Once you have downloaded and installed Thonny, you should be prompted to run the program. If not, simply open it just like any other program or app, and take a look at the bottom right-hand corner. </p>



<p>It should say something like<em> “Local Python 3 <sup>● </sup>&nbsp;Thonny’s Python”</em> like so:</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="622" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-164-1024x622.png" alt="" class="wp-image-802799" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-164-1024x622.png 1024w, https://blog.finxter.com/wp-content/uploads/2022/10/image-164-300x182.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-164-768x466.png 768w, https://blog.finxter.com/wp-content/uploads/2022/10/image-164.png 1476w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>You’ll notice that my Thonny has already been configured, but yours will not be yet. You will not have dark mode enabled, and you will not have other Python interpreters installed. First, let’s choose a Python interpreter.&nbsp;</p>



<p>Since the Pico is a simple microcontroller, we will be using Micropython, and the version you choose will depend on which kind of Pico you have. If you have a standard Pico or Pico H, select the corresponding interpreter, and if you have a wireless Pico W or Pico WH, select that interpreter and install.</p>



<p class="has-global-color-8-background-color has-background"><strong>NB</strong>: If you have the Pico plugged in, but it doesn’t seem to be recognized by your system, you may need to reconnect it while holding the “BOOTSEL” button next to your micro USB port. Once you release the BOOTSEL button, you should see the Pico connected.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-165.png" alt="" class="wp-image-802805" width="313" height="214"/></figure>
</div>


<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f30d.png" alt="🌍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended Tutorial</strong>: <a href="https://blog.finxter.com/learn-the-basics-of-micropython-for-absolute-python-beginners/" data-type="post" data-id="852391" target="_blank" rel="noreferrer noopener">Learn the Basics of MicroPython for Absolute Python Beginners</a></p>



<h2 class="wp-block-heading">Customization of Settings</h2>



<p>Alright, now let’s configure the settings as we like them. I happen to be a big fan of dark mode for most things, as it is easier on the eyes for me. First, you’ll need to select “Tools” in order to get to the options dialog:</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-166-1024x576.png" alt="" class="wp-image-802808" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-166-1024x576.png 1024w, https://blog.finxter.com/wp-content/uploads/2022/10/image-166-300x169.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-166-768x432.png 768w, https://blog.finxter.com/wp-content/uploads/2022/10/image-166-1536x864.png 1536w, https://blog.finxter.com/wp-content/uploads/2022/10/image-166.png 1600w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>Here, you will have several configuration options. </p>



<p>For most intents and purposes, Thonny’s default configurations will get the job done for programming your Pico. That said, you may not like the theme and font options (I wasn’t a big fan), so you can change them as you see fit. </p>



<p>There are a few different light and dark modes, as well as font options for both your editor and your shell (IO). You can see how I have set mine up for my own tastes.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="772" height="644" src="https://blog.finxter.com/wp-content/uploads/2022/10/image-167.png" alt="" class="wp-image-802813" srcset="https://blog.finxter.com/wp-content/uploads/2022/10/image-167.png 772w, https://blog.finxter.com/wp-content/uploads/2022/10/image-167-300x250.png 300w, https://blog.finxter.com/wp-content/uploads/2022/10/image-167-768x641.png 768w" sizes="auto, (max-width: 772px) 100vw, 772px" /></figure>
</div>


<p>That’s really it for getting started. You may need to restart Thonny for the changes to take effect. Now that you have installed and configured your Thonny, you are ready to start programming your Raspberry Pi Pico and dreaming up your own projects. Have fun!</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended Tutorial</strong>: <a href="https://blog.finxter.com/top-5-hardware-developer-job-roles-in-2023/" data-type="post" data-id="422111" target="_blank" rel="noreferrer noopener">Top 5 Hardware Developer Job Roles</a></p>
<p>The post <a href="https://blog.finxter.com/getting-started-with-thonny-the-optimal-ide-for-the-raspberry-pi-pico/">Getting Started With Thonny &#8211; The Optimal IDE for the Raspberry Pi Pico</a> appeared first on <a href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: blog.finxter.com @ 2026-04-27 04:07:10 by W3 Total Cache
-->