The Raspberry Pi WebIDE includes an advanced, yet easy to use tool, to help you work through code that you’ve downloaded or written in Python.
If you haven’t used a debugger, either on the command line or in an Integrated Development Environment (IDE), hopefully this guide will help you understand why you’d want to do so, and how to effectively debug your code.
Installation and Setup
If you already have your Raspberry Pi setup with an Operating System and the WebIDE you can skip this section, otherwise, read on for how to get up and running.
You’ll first want to setup your Raspberry Pi with an operating system on an SD card. You can learn how to setup an SD card for you Raspberry Pi, if you haven’t already done that. We also have an entire series on how to get started with your Raspberry Pi that you may find useful if you’re new to the the world of Linux and Raspberry Pi.
The next step to continue on with the tutorial will be to install the WebIDE. We have instructions for installing the WebIDE as well. It’s a fairly straightforward, and quick process to get the WebIDE installed.
Once you have both of those components setup, and installed, test that your WebIDE works by going to http://raspberrypi.local on any computer on your local network.
Now that we have everything setup, let’s start with a simple debugging session. We have a red LED that we’ve wired up, but for some reason it won’t blink correctly when we run our Python code. We’ll step through it, and try and figure out what went wrong.
The above schematic is simply using pin #25 with a resistor between 330 to 1000 ohms. If you don’t have a Raspberry Pi Cobbler, you can match up to the equivalent pins on the Raspberry Pi.
Before we copy the code, let’s setup a project in the WebIDE for this guide.
First, let’s create a new “Debugging” project within the “my-pi-projects” folder.
Next, let’s copy and paste the below code into a newly created “blink.py” file in that “Debugging” project.
For more detail: Debugging with the Raspberry Pi WebIDE