Raspberry Pi Pico programmable with the simple Basic language

Raspberry Pi Pico is a low-cost, high-performance microcontroller unveiled in January 2021 as the first Raspberry Pi board to use the foundation’s in-house developed RP2040 chip. The board is designed for rapid prototyping and development applications, providing an affordable and powerful platform for projects embedded.

Il chip RP2040 on which Raspberry Pi Pico bases its operation, integrates a 133 MHz ARM Cortex-M0+ dual-core processor, 264 KB of RAM. The card integrates numerous features and connectors that make it very versatile. Think of the 26 pins GPIO which can be used to connect a variety of sensors, actuators and other devices.

The card supports the serial communication, I2C, SPI and PWM to connect to other devices and components. It also consists of 2MB of flash memory on-board for saving firmware and data. Raspberry Pi Pico can be powered through a micro USB connector o tramite i pin GPIO.

In July 2022, Raspberry Pi Pico W was also presented, a variant that also features WiFi support. Recently (June 2023) it has also been enriched with Bluetooth connectivity.

A Basic interpreter for Raspberry Pi Pico

And interprete Basic is a program that reads, parses and executes instructions written in the Basic language. The Basic (Beginner’s All-purpose Symbolic Instruction Code) is a high-level programming language developed in the 1960s to make programming more accessible to beginners. Basic interpreters allow users to write instructions in Basic language and to see them executed immediately.

Unlike the compilers, which translate the entire program into machine language before execution, interpreters work line by line. The interpreter reads a line of code, parses it and executes it immediately, displaying the results or any errors. In another article we saw the differences between compiled and interpreted language.

Even though Basic has lost some of its popularity over the years, Basic interpreters are still used today as learning tools and for developing simple applications.

The piccoloBASIC project, recently shared on GitHub, aims to simplify the Raspberry Pi Pico programming thanks to the use of a Basic interpreter. Users can use all the fundamental constructs such as let, if, print, for, goto e gosub. Also, you can interact with the pin GPIO directly, without too much balancing act.

The Raspberry Pi Pico is normally programmable using the programming language C/C++ o MicroPython. You can use an integrated development environment (IDE) of your choice, such as the development software Arduino or MicroPython IDE, for writing and uploading code to the Pico.

Starting point for making piccoloBASIC it was uBASIC by Adam Dunkels,”a really simple BASIC interpreter” as it is described. “Written in a couple of hours, for the hell of it, it’s used in a lot of places today“.

How to use piccoloBASIC with Raspberry Pi Pico

To start working with piccoloBASICyou must first install theSDK Pico C/C++. The Getting started support documentation is the best place to start. There environment variable PICO_SDK_PATH should be defined as follows:

PICO_SDK_PATH=/home/pi/pico/pico-sdk/

At this point, just clone the code from the GitHub repository, create a directory called build. Going to this folder, you must then issue the following command:

make -j4

The resulting file, called piccoloBASIC.uf2can be sent to the Raspberry Pi Pico board by rebooting by pressing bootsel then copying the .uf2 file.

LEAVE A REPLY

Please enter your comment!
Please enter your name here