PiccoloBASIC is an open-source BASIC interpreter for the Raspberry Pi Pico development board that’s based on “uBASIC: a really simple BASIC interpreter” by Adam Dunkels and relying on Arm’s LittleFS fail-safe filesystem for microcontrollers.
If my memory serves me well, my first computing experience was at school using a Thomson TO7 computer that we programmed with BASIC. I don’t think the language is still used in practical applications, but we can still see some BASIC projects pop up from time to time such as a BASIC interpreter for the Arduino Zero boards. Gary Sims, owner of the Gary Explains YouTube channel, has now ported a BASIC interpreter to the Raspberry Pi Pico.
- Let, if, print, for, goto, gosub
- String variables (let z$=”hello”)
- Floating point numbers and variables (let z#=1.234)
- Builtin functions [zero, randint, not, time]
- Sleep, delay, randomize, push & pop (for integers)
- Maths functions like cos, sin, tan, sqr, etc
- LittleFS support
- Rudimentary GPIO support
But it’s still good enough for Hello World, Blinky, and other code samples. Here’s what Hello World looks like:
print "Hello World"
Raspberry Pi Pico’s 2MB flash has been partitioned to have the first 640KB for the PiccoloBASIC firmware, and the rest for LittleFS to add BASIC programs, Python scripts, and so on. Besides fixing a few bugs, Gary plans to work on more features such as peek and poke, longer variable names (currently just one letter), support for negative, 64-bit, and hex numbers, better loops (steps, reverse, while, etc..), File IO, and more hardware support with I2C, SPI, Bluetooth, USB keyboard, etc…
You’ll find the source code and more details on GitHub, and an introduction video on Gary Explains’ YouTube channel.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.