button_controlled_led

This is an old revision of the document!


Button Controlled LED

Jul 2026
THIS IS WORK IN PROGRESS AND IS NOT FINISHED YET.




Introduction


I did not want to lead of talking about a simulator, if you have your Pico, have installed Thonny, have some basic parts, breadboard, LEDs, switches, wires etc, and you want to build something physical, please skip this section and come back to it later.

However, if you have no hardware yet, but want to do some Micro Python work, then you can start here by simulating some electronics, and controlling those electronics with real Micro Python code.

The simulator is called WokWi, and it can be found here. WokWi emulates many devices, including Arduino, ESP32, STM32 and Raspberry Pi Pico. If you want to get directly to the Pico section, then please click the link here.


A Simple LED Button Project

When you first open WokWi, you will be presented with a split page, with your code section on the left and a Raspberry Pi Pico on the right (if you used the direct link).


As can be seen, the Raspberry Pi Pico is already added, there is some simple code, but it does not use any hardware, so it not of any interest to us.

In the top middle of the page, there are three icons, the first is a play button, the second allows you to add components and the third gives some display options.

Click the blue + button.


A drop down will appear where you can select from a list of components, select the LED.

This will place an LED on your active project page.


While the LED is selected (has a dotted line around it) you can change some parameters, if you look just below the blue + button, there is now another set of options.

There is a set of coloured squares, this lets you set the colour of your LED, while the colour range is quite nice, I am pretty sure you cannot buy LEDs of these colours!. The next set of icons allow you to rotate and flip the LED image, to make wiring simpler.

Set your LED the same as mine, with the straight leg (Cathode/negative) on the right and the dog leg (Anode/positive) on the left. You will likely have to flip/rotate the LED to get this view.

Next we are going to add a resistor (a current limiting resistor, so that we don't blow up the LED or damage the Pico).

Click the blue + button again, and select Resistor from the list.


This will add a resistor to our project page.


While the resistor is selected, you can change its properties, just under the blue + button. Set the resistor to 330 ohms, and use the rotate symbol to get the correct orientation.

button_controlled_led.1783633492.txt.gz · Last modified: by walkeradmin