- Older »
- Debugging enhancements. Thanks to the support from Raspberry Pi Foundation, Thonny now has several new debugger-related features. The original debugger has been very useful for explaining the meaning of Python constructs, but its memory and time overhead became noticeable when making bigger steps in some programs (especially after the introduction of stepping back in time).
- Installing Thonny. Thonny is a Python IDE (an Integrated Development Environment). It's the software you'll install on your computer to program your Pico. If you're programming your Pico from a Raspberry Pi running the desktop version of Raspberry Pi OS, Thonny should be installed already.
- After saving the code to your ESP board using Thonny IDE or uPyCraft IDE, rotate the potentiometer. Check the shell of your MicroPython IDE to read the values from the potentiometer. If you’re using an ESP32 you should get readings between 0 and 4095 — or readings between 0 and 1023 with an ESP8266.
This is last release announcement in the blog. From now on Thonny’s development takesplace in GitHub (https://github.com/thonny/thonny) and the releases will be described there:
Download Thonny - Get familiar with the Python programming language using a novice-friendly IDE that provides you with several helpful learning tools, all packed into an intuitive GUI.
This is a bug-fix release.
Changes since 3.0.5:
3.0.8 (2018-11-15)
- FIXED #597: The directory with Python scripts may not be in path for executing system commands from shell
- FIXED: Make executing shell commands compatible with Python 3.5
- FIXED: Make MyPy support compatible with older MyPy versions
- FIXED: Make turtle.pyi compatible with Python 3.5 and remove Windows linebreaks
- FIXED: MyPy error col offset
3.0.7 (2018-11-14)
- FIXED #592: MyPy doesn’t work when cwd sys.prefix
- FIXED #593: No-message exceptions crash the Assistant
- FIXED #595: Running system commands causes an error
- FIXED #596: Arguments are ignored when running system commands from shell in Posix
3.0.6 (2018-11-13)
- FIXED #538: Turtle programs may give false warnings (Typeshed stubs were not packaged)
- FIXED #586: Import interception mechanism fails for some modules
- FIXED #591: Assistant fails when filename is missing from error info
Here are the changes since version 3.0.1:
3.0.5 (2018-10-26)
- FIXED #573: “Highlight matching names” and “Highlight local variables” makes editor very slow
- FIXED #574: Error in outline
- FIXED #578: resizing local variable pane in debugger causes error
3.0.4 (2018-10-22)
- FIXED #564: In Windows “Highlight local variables” and “Higlight matching names” cause Thonny to load Jedi files
3.0.3 (2018-10-21)
- FIXED: Regression from 3.0.2 (incomplete code refactoring)
3.0.2 (2018-10-21)
- FIXED #563: Problems with HeapView and EventsView
- FIXED #565: Don’t replace tabs in shell
This is the first published stable release of Thonny 3.0.
Thonny 3.0 has many new features and most of them have been introduced already in previous posts or explained elsewhere:
- Syntax and UI themes (https://bitbucket.org/plas/thonny/wiki/Theming)
- Breakpoints and different debug modes (https://thonny.org/blog/2018/08/11/version_3_0_beta.html)
- Core built-in support for MicroPython (https://bitbucket.org/plas/thonny-micropython)
- Assistant view which performs static analysis on your code and tries to explain error messages (https://thonny.org/blog/2018/09/01/version_3_0_0b5.html)
- Stepping back while debugging (https://thonny.org/blog/2018/05/04/version_2_2_0_beta.html)
- New Windows installer allows installing Thonny for all users (https://thonny.org/blog/2018/07/25/version_2_1_21.html)
Development of several features were suggested and supported byRaspberry Pi Foundation. Many thanks to them!
There are some important changes in the requirements:
- Minimum supported Python version (both for the front-end and back-end) is Python 3.5
- Minimum supported Tk version is 8.6 (recent Python versions published at https://www.python.org come with Tk 8.6)
- macOS bundle requires at least macOS 10.9. For older macs you need to install Python (with Tk 8.6) and Thonny separately.
- By default Thonny runs user programs with the same interpreter, which runs the front-end (https://thonny.org/blog/2018/08/11/version_3_0_beta.html, section “New default back-end”)
- pip GUI (Tools => Manage packages) now installs packages to different location (https://thonny.org/blog/2018/08/11/version_3_0_beta.html, section “More straightforward user package management”)
All new features and changes are listed in the changelog: https://bitbucket.org/plas/thonny/src/master/CHANGELOG.rst
Big thank you to everybody who have helped Thonny so far!
You can find download links from Thonny’s homepage.
Most new features happened in previous betas, but this one still has one big new feature – meet the Assistant!
See Thonny’s Bitbucket downloads page for download links or pip install –pre thonny into a virtual environment.
Assistant
Just like new debugger features, this feature has been supported by Raspberry Pi Foundation (https://www.raspberrypi.org/). Many thanks to them!
Assistant is a new view in Thonny, which observes your program runs and offers help if you get an exception or if it finds something fishy in your code. It uses Pylint and MyPy for static analysis and custom dynamic analysis for understanding the error situations better.
Here is an example:
Many error types are not supported yet – you may even call it a proof of concept for now. Here is where your help is needed – if you meet a situation where Assistant could be more helpful, then click on the feedback link at the bottom of the view and let us know! You are welcome to discuss this feature also here under this blog post or in the main forum.
All changes since 3.0.0b3
- NEW: When program has syntax error or crashes with an exception, Assistant pane opens and tries to help diagnose the problem. Uses Pylint, MyPy and custom dynamic analysis under the hood. (Big “Thank you!” to Raspberry Pi Foundation for the support!)
- ENHANCEMENT: Resizing the main window doesn’t mess up views’ layout anymore.
- ENHANCEMENT: Better support for debugging f-strings.
- ENHANCEMENT: Nice debugger now recovers better when it is not able to understand a program.
- FIXED #496: Regression which caused Variables view to skip variables updates during “nicer debugging”.
- FIXED #440: Copy&paste over a selection will now delete the text selection first (was problem for some Linuxes)
- FIXED: Removed a nasty debugging statement left into b3, which may cause a crash in the end of debugging.
Happy re-independence day to Estonia!
See the homepage for download links, and wiki for installation instructions.
Changes since 2.1.21:
- ENHANCEMENT: Less intrusive logging for AST marking problems
- FIXED #340: Validate geometry before loading
- FIXED #363: subprocess.run causes Thonny backend to hang
- FIXED #419: logging doesn’t work in user programs
- FIXED #440: In Linux paste over selection doesn’t remove the selection
- FIXED #487: Use PyPI.org and turn off pip warnings in package manager
- FIXED #490: Debugger gets confused with f-strings
- FIXED: In case of back-end problems, kill backend instead of resetting
- FIXED: Colorize f-string prefixes
Thonny 2.2 beta already brought along many new features, but they kept coming, so I decided to skip 2.2 stable release and continue under version 3.0.
See Thonny’s Bitbucket downloads page for download links.
Debugging enhancements
Thanks to the support from Raspberry Pi Foundation, Thonny now has several new debugger-related features.
The original debugger has been very useful for explaining the meaning of Python constructs, but its memory and time overhead became noticeable when making bigger steps in some programs (especially after the introduction of stepping back in time). Although the performance has been greatly improved in 3.0 beta, larger programs would still benefit from a more efficient solution.
Thonny now has two debug modes. Beside the original AST-based debug mode – the “nicer” one (Ctrl+F5), there is new, traditional line-based mode – the “faster” one (Shift+F5). The new mode is not as intuitive but much more efficient. We expect that most students start with the nicer debuger and move on to the faster one when their programs grow bigger.
By default the new debugging mode still uses stacked windows for presenting the call stack. This gives good intuition about the concept, but it may become cumbersome to use. Therefore in 3.0 one can choose between two different styles for presenting call stack. In “Tools → Options → Debugger” you can switch to more traditional style with a separate view for presenting and switching call frames. Note that both styles can be used with both debugging modes.
Last, but not least, Thonny finally supports breakpoints. For using them, you need to switch on line numbers (Tools → Options → Editor). This gives you the margin, where you can add or remove breakpoints with double-clicks. Note that you don’t need to use breakpoints – if you start the debugger without breakpoints, Thonny stops before the first statement, just like it used to.
New default back-end
Thonny 2.1 introduced automatically managed virtual environment as default back-end. The idea was to allow students start from clean slate and add packages later without worrying about the integrity of whole system. It turned out that many instructors did not like this scheme as it often made things more complex and confusing, especially in classroom setting.
In version 3.0 the default back-end is “The same interpreter which runs Thonny” (by the way, this was already the default setting on Raspberry Pi). This means your programs will see all Python packages that are installed to this interpreter. Instructors can now install extra packages to the central interpreter and students will see the packages without any hassle.
This change does not mean that I now consider virtual environments unimportant. As a new feature, Thonny 3.0 offers an easy way for creating and using virtual environments (Tools → Options → Back-end → Alternative Python 3 interpreter or virtual environment).
“A special virtual environment” back-end is still available and if you used it with your older Thonny, then Thonny 3.0 will use it as well. If you are using Thonny+Python bundle, then 3.0 will start by creating new virtual environment, because the one created for Python 3.6 does not work with Python 3.7.
More straightforward user package management
Now when default back-end is not a virtual environment, how can users install extra packages? In 3.0 the package manager (“Tools → Manage packages…”) installs to user site packages (with pipinstall--user) when back-end is not a virtual environment. The plug-ins manager always installs to user site packages, unless Thonny itself is run from a virtual environment.
You can also install packages outside of Thonny (either with or without --user) and these will be visible in Thonny.
Basic MicroPython support built-in
MicroPython plug-ins for Thonny have been available for a while, but so far this topic was kept separate from the main project. Since Thonny 3.0 the core of these plug-ins will be developed and distributed as part of the thonny package. For the end-user this means that it is possible to program MicroPython devices without installing any extra plug-ins (just select “Tools → Options → Back-end → MicroPython on a generic device”). For more complete support (eg. for installing or updating firmware) there are device-specific plug-ins/back-ends available. See https://bitbucket.org/plas/thonny/wiki/MicroPython for more info.
New Windows installer
This was already introduced in 2.1.21, but let’s repeat it here as well. You can now use Windows installer for installing either for current user or for all users. See the 2.1.21 announcement for more info.
Themes
In case you missed 2.2 beta announcement – Thonny now has ability for changing UI and syntax themes (Tools → Options → Theme & Font).
New versions / requirements
- Thonny+Python bundles now come with Python 3.7.
- Python 3.4 is not supported anymore (neither for front-end nor as back-end).
- Tk 8.5 is not supported anymore.
- Mac bundle now requires macOS 10.9 or later (because it bundles 64-bit only Python). Note that you can still pipinstallthonny on older Macs (provided you have Python with Tk 8.6).
How to test the beta without affecting your stable Thonny?
If you don’t want to overwrite your current Thonny, then you can pipinstall--prethonny into a virtual environment. Since 3.0, when Thonny is run from a virtual environment, it keeps all user data (eg. configuration.ini) also inside this environment. This way you don’t risk messing up the configuration of your stable Thonny version and you can get rid of the beta just by deleting the virtual environment.
All new features and changes since 2.2b4
- NEW: Thonny now has two debug modes: beside original AST based debug mode (the “nicer” one, Ctrl+F5) there is now also line-based mode (the “faster” one, Shift+F5), which is not so intuitive but much more efficient.
- NEW: Both debug modes now support breakpoints (switch on line numbers and double-click on the margin)
- NEW: Alternative presentation for call stack (in single window, just like in most debuggers; see Tools => Options => Debugger)
- NEW: Clicking on the links in stacktrace now shows the variables of those frames.
- NEW: You can re-run your changed program without closing it first (relevant for graphical programs).
- NEW: Checking “Run => Dock user windows” makes your Tkinter windows stay on top and appear always on the same location. This allows tweaking your turtle programs while looking at current output.
- NEW: “View => Program arguments” opens a box where you can write the argument string for your program
- NEW: “Tools => Options => Backend => Custom Python interpreter” now allows creating virtual environments
- NEW: “Tools => Manage packages” now allows installing new packages with all CPython backends, not only virtual environments. If the backend is not a virtual environment it installs to user site packages (with pip install –user)
- NEW: Thonny now includes basic support for MicroPython (former thonny_microbit plug-in). See https://bitbucket.org/plas/thonny/wiki/MicroPython for more info.
- CHANGED: Upgraded Python to version 3.7.0 in Thonny+Python bundles
- CHANGED: Dropped support for Python 3.4 (both for front-end and back-end)
- CHANGED: Dropped support for Tk 8.5. All bundles (including Mac’s) now come with Tk 8.6.8
- CHANGED: Default back-end is now “Same as front-end” (was “A special virtual environment”). This makes deployment easier in classroom setting and it is simpler scheme in general. “Special virtual environment” backend may be removed in future versions.
- CHANGED: Plug-ins will be now installed to regular user site packages directory (was ~/.thonny/plugins)
- CHANGED: If Thonny (front-end) is run from a virtual environment, user directory (with configuration.ini and logs) will be .thonny under virtual environment’s root directory (instead of usual ~/.thonny).
- ENHANCEMENT: Better Windows installer (run as administrator for all-users install)
- ENHANCEMENT: thonny.exe is now digitally signed
- ENHANCEMENT: On Linux Thonny now uses native file dialogs (via zenity)
- ENHANCEMENT: Nicer debugger can now step into your functions defined in other modules
- ENHANCEMENT: Nicer debugger can now stop before the assignement of loop variable in for-loops
- ENHANCEMENT: “Run to cursor” can be called by right-clicking desired line in the editor and selecting the command from context menu
- ENHANCEMENT: Great time and memory optimizations in nicer debug mode. The ability to step back in time is not so expensive anymore.
- ENHANCEMENT: Thonny now detects external file modifications and proposes to reload
- ENHANCEMENT: New Windows installer (run as administrator for all-users install)
- FIXED #163: Uninstaller now correctly removes “Open with Thonny” context menu entry
- FIXED #340: Validate geometry before loading
- FIXED #358: sys.exit() in user programs doesn’t show stacktrace anymore
- FIXED #363: subprocess.run causes Thonny backend to hang
- FIXED #375: Files are now saved with linebreaks suitable for current platform
- FIXED #419: logging doesn’t work in user programs
- FIXED #422: Make Ctrl+C, Ctrl+V etc. work on Greek keyboard
- FIXED #440: In Linux paste over selection doesn’t remove the selection
- FIXED #450: Locals marker doesn’t work with jedi 0.12
- FIXED #468: Problem with changing backend interpreter
- FIXED #471: Problem when Thonny uses jedi 0.11 or newer
- FIXED #475: Heap view misbehaving on startup
- FIXED: “Run => Run to cursor” works again
- FIXED: Thonny now honors PEP 263 style encoding markers when saving files. (UTF-8 is still the default)
- FIXED: Problem when jedi 0.10 and parso are both installed
- FIXED: Various problems with pip GUI
- FIXED: Variables view misses events
- FIXED: Error when last back-end was not available anymore
- FIXED: problems with pip GUI in virtualenv
- TECHNICAL: Plug-in writers can now control each import in user programs (thonny.backend.VM.add_import_handler)
- TECHNICAL: Communication messages between back-end and front-end were changed
- TECHNICAL: Thonny doesn’t tweak PYTHONUSERBASE anymore to put plugins under ~/.thonny. Regular user site packages is used instead
- TECHNICAL: Dependency to “packaging” introduced in 2.2 betas is now replaced with “setuptools”
- TECHNICAL: Implemented ChoiceDialog
Highlights:
- New installer for Windows bundle. Now you can also install Thonny for all users (eg. under C:ProgramFiles(x86)). For this you need to run the installer as administrator (right-click installer exe and select “Run as administrator”). If you run it with simple double-click, then you get old behaviour (installing for your user only).
- Bundled Python version was upgraded to 3.6.6.
See the homepage for download links, and wiki for installation instructions.
Whole changelog since 2.1.17:
2.1.21 (2018-07-17)
- FIXED #471: Another problem when Thonny uses jedi 0.11 or newer
2.1.20 (2018-07-16)
- FIXED: Problem when jedi 0.10 and parso are both installed
2.1.19 (2018-07-16)
Updates in this version are relevant only on Windows
- FIXED #467: Error when running Thonny with pythonw on Windows (regression from 2.1.18)
- ENHANCEMENT: New Windows installer (run as administrator for all-users install)
- ENHANCEMENT: Upgraded Python to version 3.6.6 in Thonny+Python bundles
2.1.18 (2018-06-22)
- FIXED #450: Locals marker doesn’t work with jedi 0.12
Thonny 2.1 had a plug-in called thonny-microbit, which added possibility to program BBC micro:bit.
Thonny 2.2 has plug-ins which add more general support for various MicroPython devices – see https://bitbucket.org/plas/thonny-micropython for more info.
NB! You need at least Thonny 2.2b3 to test it!
Version 2.2 contains several new features and some bug-fixes (listed below). This post will be updated during the beta phase to let you know about the progress.
See Thonny’s Bitbucket downloads page for download links.
Stepping back in time
One of the new features in 2.2 is possibility to step back in time during debugging. This comes in handy when you are debugging with big steps (step over) and accidentally step over an interesting part in code. Instead of starting from scratch again, you can now issue the command “Run -> Step back” which brings the visual represetation of the program back to the state as it was before last debugger command. From there you can choose to continue with small steps (step into). You can make as many steps back as required and you can go back and forward as many times as you wish.
Stepping back was implemented by Alar Leemet as part of his Bachelor thesis. Please give him feedback about this feature!
2.2.0b4 (2018-06-05)
- FIXED: Couldn’t open menus with None backend
2.2.0b3 (2018-06-05)
- FIXED #425: Too big automatic scaling
- FIXED #427: Can’t run files with spaces in filename
- FIXED: Fixed a bug when debugging and encountering an exception (by Alar Leemet)
- ENHANCEMENT: Show indicator about stepping in the past in the text of editor tabs
- ENHANCEMENT: Added Thonny version guards for installing plug-ins
- EXPERIMENTAL: Preliminary support for running system commands in Thonny shell (eg. !ls or !dir)
- TECHNICAL: thonny.exe in Windows bundle is now signed
- TECHNICAL: Delay starting of Runner until UI is shown
- TECHNICAL: Various enhancements to support MicroPython plug-ins (https://bitbucket.org/plas/thonny-micropython)
2.2.0b2 (2018-05-04)
- FIXED: Options dialog crashes when Variables view hasn’t been created yet
2.2.0b1 (2018-05-04)
- NEW: Added support for stepping back in time during debugging (Run => Step back) by Alar Leemet. If you accidentally stepped over an interesting part of code, then now you can step back and step into.
- NEW: Added support for UI and syntax theming (https://bitbucket.org/plas/thonny/wiki/Theming)
- NEW: Added several built-in dark themes
- NEW: Added support for display scaling / high-DPI screens (Tools => Options => General)
- NEW: Added closing buttons to the tabs of all views
- NEW: Added support for (CPython) back-end plug-ins (https://bitbucket.org/plas/thonny/wiki/Plugins)
- NEW: Current editor line can be highlighted (Tools => Options => Editor)
- NEW: Thonny can be started in simple mode (https://bitbucket.org/plas/thonny/wiki/Modes)
- NEW: Variables view now allows viewing variables from other modules beside __main__ (Tools => Options => General)
- CHANGED: Dropped support for Python 3.4 (both for front-end and back-end)
- CHANGED: Reorganized back-end configuration (“Tools => Options => Back-end” instead of “Tools => Options => Interpreter”)
- CHANGED: The roles of Interrupt and Stop commands are now more clear: Stop always restarts the backend and Interrupt only tries to interrupt
- CHANGED: Editing the running program doesn’t interrupt it anymore.
- CHANGED: Object inspector now shows attributes and object overview on different tabs
- CHANGED: Can’t set thonny.THONNY_USER_DIR directly in customize.py anymore (https://bitbucket.org/plas/thonny/wiki/DeploymentOptions)
- CHANGED: For plug-in writers: Unified early and late plug-ins (load_early_plugin should be renamed to load_plugin)
- CHANGED: For plug-in writers: get_workbench and get_runner moved from thonny.globals to thonny
- FIXED #358: Hide the stacktrace of SystemExit
- FIXED #368: “Open system shell” doesn’t work in Xfce (fix by Miro Hrončok)
- FIXED #370: Made zooming with Ctrl++ / Ctrl+- work on the numpad on Linux
- FIXED #372: Now it’s possible to specify a link as backend interpreter (fix by Miro Hrončok)
- FIXED #396: exec causes range marker to crash
- FIXED #403: Window width may become negative
- TECHNICAL: Changed the location and sharing of backend.py, common.py, ast_utils.py
- TECHNICAL: Cleaner approach for sharing jedi with the back-end
- TECHNICAL: Package manager now uses pypi.org instead of pypi.python.org
- TECHNICAL: Several changes in Runner and BackendProxy interface
- TECHNICAL: Saving an editor now forces writing to disk (see https://learn.adafruit.com/adafruit-circuit-playground-express/creating-and-editing-code#1-use-an-editor-that-writes-out-the-file-completely-when-you-save-it)
- Older »
What a time, eh? After an absolute whirlwind of a launch, Raspberry Pi Picos are starting to land through people's letterboxes and a lot of folks who've not had much to do with microcontrollers before are looking for a place to start figuring out what to do with them. Welcome! Now is the perfect time to get onboard the microcontroller train - you're going to love it.
What is this guide?
In this guide, we're going to give a brief, beginner friendly primer on the Pico and show you the steps necessary to get it set up and ready for programming with MicroPython. We'll also cover what you need to do to be able to play with various Pimoroni add-on boards. We'll have more specific content for individual boards in the future, but hopefully this guide will be just enough to get you started experimenting with your Pico.
We're not going to go into huge detail about everything the Pico can do here - for a comprehensive, beginner friendly guide with lots of fun experiments to do with physical hardware we'd recommend the excellent Getting Started with MicroPython on the Raspberry Pi Pico book. If you're after technical detail we'd suggest checking out the resources on the Raspberry Pi site, including the extensive Pico datasheet. If you know how to program a microcontroller already you can find function references for our boards and suchlike in our Pico Github repo.
About Raspberry Pi Pico
Thonny Download For Mac
Raspberry Pi Pico is Raspberry Pi's first microcontroller board, designed around their very own microcontroller chip - the RP2040. A Pico is not a replacement or upgrade for a Raspberry Pi - they're very different beasts! A Raspberry Pi is a Single Board Computer that runs Linux, to which you can connect a monitor, keyboard and mouse and interact with via a terminal prompt or a graphical user interface such as the Raspberry Pi OS desktop. You can run many different Linux applications on a Raspberry Pi and it has a ton of processing power and RAM.
Thonny Download Mac
While Raspberry Pis are champion multi-taskers, microcontrollers shine in projects where they have one job and need to do it well. Because they're programmed from another computer and don't need to run a full OS, they have greatly reduced power consumption compared to SBCs and are ideal for powering from batteries. Programs on microcontrollers just start running once they're powered up, so there's no boot up time, and you usually don't need to shut them down safely. Focusing on just one thing means that microcontrollers are typically more stable and predictable, making them perfect for using as the brains of projects that need to Just Work, like industrial machines, coffee makers or emergency zombie defence turrets.
Interfacing with hardware is also more straightforward with microcontrollers, and Raspberry Pi Pico is specifically geared towards physical computing (AKA connecting it to interesting stuff that lights up, moves or makes noise). Unlike a Pi, Pico has inbuilt Analog to Digital Convertors (ADCs) so you can connect it to a wider range of sensors and inputs. It also has Programmable IOs (PIOs) which are used behind the scenes in our libraries, outsourcing simple bits of programs to run in the background and freeing up the majority of the Pico's CPU to concentrate on the trickier parts. If you're interested in the possibilities of PIOs check out our Unicorn Pack page, where we describe how we managed to get 14 bits of resolution from the LED drivers on the Pico version (meaning improved rainbows!)
What you'll need
Thonny Download For Mac
A Raspberry Pi Pico!
A USB cable - you'll need a microB USB cable to plug your Pico into your computer to be able to program it. You may well have one already, from an old phone, a Pi Zero or a micro:bit but you'll need it to be capable of transmitting data over USB as well as power. All the cables we sell are)
and pressing enter. See how it parrots
hello world
right back at you? Your Pico is talking back to you via the serial console and it can tell you all sorts of useful things - error messages and anything youprint
(such as sensor readings) will show up in this box. This can be very handy for debugging your code!Of course, you will probably want to queue up more than one line of instructions to make up a program- that's what the top box is for. Here's a basic program you can try to test out your Pico is working properly, before soldering anything to it. You can either copy and paste it into Thonny or type it in. If you're typing it in, make sure the bottom two lines have four spaces in front of them to indent them (indents are used here to denote when code is part of a loop).
This program
- imports the modules necessary to let your Pico interact with basic hardware and know about the concept of time
- gives the Pico's onboard LED a friendly name (led) so it's easy to refer to in code, and sets it as an OUTput.
- sets up a simple loop, which turns the onboard LED on or off, waits two seconds, and then repeats.
Once you're ready to transfer the program to your Pico, press the green 'run current script' button in the top toolbar. You'll be prompted to give it a name - you can use any name you like, but if you save the file to your Pico as
main.py
it will run automatically when the Pico is connected to power, you won't need to start it in Thonny. This is useful if you want to make a battery powered project that won't be connected to a PC!Note that when using MicroPython you won't be able to copy code that you've written to your Pico by holding the button down to put it into bootloader mode and copying the file across - you'll always need to transfer it using Thonny.
Soldering the headers
To plug in our addon boards or to plug your Pico into a breadboard, your Pico will need to have headers soldered to it, with the pins sticking out of the back. Soldering headers is not hard with modern PCBs and we'd encourage you to give it a go (but if you'd rather skip the soldering, we should have pre-soldered Picos available very shortly).
Your headers might come pre-separated into two 20 pin lengths, or in one long length. If it's the latter, you can separate them in to two lengths with side cutters (it's also possible to break them apart with sturdy scissors, or even your thumbnail).
You'll need to solder your headers so that the pins are sticking out of the back of the Pico, with the long pins sticking out of the side with the labels and the soldering itself on the side with the button. The pins should be at right angles to the Pico so that they can plug into things nicely. Using a breadboard to hold the pins in place while you solder is a good way of making sure things remain square while soldering, but you can also use a large blob of blu-tack or similar to hold things together (or even a helping hand, if you're fancy).
Poke the long ends of your two lengths of header into your breadboard, the same width apart as the two rows of holes on your Pico.
Place your Pico on top of the short ends with the button and the raspberry facing upwards.
Make sure your workspace has adequate ventilation and consider wearing eye protection as solder can sometimes behave unexpectedly. Once you're ready to start soldering, make sure to tin the end of your iron - wait until it's up to temperature, melt a little bit of solder onto the tip and then clean off the excess using your tip cleaner. You're ready to go!
You'll want to position your soldering iron so it's applying heat evenly to the header pin and the pad on the board, and then hold it in place for a few seconds. You can then feed a little bit of solder into the place where the pad, the iron and the header pin meet - don't go overboard with the solder, you only need a tiny bit and you can always add more later. The solder should flow satisfyingly down the iron and form a joint between the pad and the pin.
We'd suggest soldering one pin at each end, and then checking again to make sure the headers are square. You can adjust them at this point if you need to, but you won't be able to later. Once you're satisfied that everything is 90°, go ahead and solder the rest of the pins.
When you're done, check your solder joints from all angles. A good joint should surround the pin on all sides, and ideally should be shaped like a squat little cone. If you have joints that don't quite surround the pin, heat up the solder again to reflow it, and hopefully it will fill the gaps. If it doesn't, you can add a bit more solder (but try reflowing the solder on its own first). You'll also want to check for solder joints that touch and bridge two pins - if you have any of these you can fix them by holding your iron to the middle of the unwanted join for a second or two, which should make the two blobs separate.
When removing your Pico from the breadboard we'd suggest holding on to the long edges and rocking it gently from side to side whilst pulling upwards slowly - try to avoid putting too much pressure on the pins at the ends as these are most liable to bend. If they do get bent you can bend them back, but doing this too many times can cause metal fatigue.
Using Pimoroni Bases and Packs
Once your Pico has headers attached, it's fully equipped for plugging into one of our Packs or Bases. All our Pico addons have markings that should make it obvious which way round you need to plug it in - here is a upside down Display Pack, ready for plugging in to a Pico (the surfaces shown in the photo below will be on the inside of the Pico+Pack sandwich).
Double check you've got the male and female headers lined up, and push on the edges of the board to join them together (if you're using a Display Pack, take care not to apply pressure to the screen).
Pico landing areas on Bases are similarly marked, just match up the markings on the PCB to figure out which way round the Pico should go.
Removing Pimoroni Bases and Packs
If you need to remove your Pico from a base or pack, hold on to the long edges of the boards and wiggle them gently from side to side whilst slowly pulling the boards away from each other. The headers can grip on quite securely so it's best to hold onto the edges of the PCBs while you're separating them, don't pull on the Pico's USB port or any of the components on your Pack or Base.
Running our examples
Once everything's assembled we'd suggest checking out our example code - you can find the MicroPython examples here. Once you've found the .py file for the demo you want to try, you can copy and paste it into Thonny and run it in the same way as you ran the blink example (if you click on the 'Raw' button it will strip out all the Github formatting, making it easier to copy and paste).
We should have more code examples and starter projects coming soon, as more functions get added to MicroPython and as we learn more about what the Pico is capable of!
Troubleshooting
My Pico doesn't show up as a drive when I connect it to my computer!
Unlike some other microcontroller boards, you'll need to hold down the BOOTSEL button whilst plugging it in to your computer for it to show up as a drive. If you're doing that and it's still not showing up, you might be using a power only USB cable - try a different one!
I get an ImportError in Thonny when I try and flash my code!
If you get an error that looks something like
ImportError: no module named 'picodisplay'
then you probably have the vanilla Raspberry Pi MicroPython .uf2 installed instead of the Pimoroni one. Scroll back up to the 'Installing the Custom Firmware' section for instructions on how to download and install the correct firmware.I get a 'Device is busy' error in Thonny when I try and flash my code!
If you get this error when you press the 'run current script' button to send code to your Pico, press the red 'stop/restart backend' button first to stop it from doing whatever it's doing.
How do I factory reset/delete files from my Pico?
If you need to delete all your programs from your Pico's flash memory and start again from scratch, you can do that by downloading this special .uf2 file and copying it to your Pico whilst it's in bootloader mode. We found this useful when we had a malfunctioning main.py which was locking up the Pico to the extent that it could longer communicate with Thonny. You'll need to copy the MicroPython image across again afterwards.