NanoBASIC UNO Is a Minimal Yet Flexible BASIC Interpreter for the Arduino UNO and Other ATmega328Ps
Permissively-licensed firmware gives you a modernized BASIC — with REPL and multi-line program support.
Pseudonymous maker "shachi-lab" has released a BASIC interpreter designed for the Arduino UNO R3 and earlier and other development boards built around Microchip's classic eight-bit ATmega328P and compatible AVR microcontrollers: NanoBASIC Uno.
"NanoBASIC UNO is a minimal BASIC interpreter developed by shachi-lab for eight-bit AVR microcontrollers (Arduino UNO/ATmega328P)," the maker explains of their creation. "It is a modern reconstruction of the original BASIC interpreter written in 2012 for the [STMicroelectronics] STM8S platform, redesigned with a clean architecture and reimplemented for today's MCU environments. The goal of this project is to provide a compact, practical BASIC environment for small microcontrollers, using only minimal memory."
Available now in its first public release, NanoBASIC UNO provides a read-eval-print-loop (REPL) interface for immediate execution of interpreted BASIC programs alongside support for multi-line programs executed on-demand. The latter includes an unusual feature for a BASIC: line numbers are optional, used only as labels for jump operations. Other forms of structured control flows, including do and while loops and conditionals, have no need of line numbers.
"NanoBASIC UNO uses a modern expression parser that feels closer to C than classic BASIC," shachi-lab explains. "It supports unary operators (-, !, ~), bitwise logic, shifts, and compound assignment. This keeps the language expressive without losing BASIC's simplicity [which is] especially useful on an 8-bit MCU where bitwise operations really matter. NanoBASIC UNO can [also] directly control GPIO [General-Purpose Input/Output pins], ADC [Analog to Digital Converter], and PWM [Pulse-Width Modulation outputs], so it's not just a tiny interpreter — you can actually drive hardware, read sensors, and control actuators from BASIC, whether in REPL mode or from stored programs in Run mode."
Full source code and example programs for the project are available on GitHub under the permissive MIT license; shachi-lab warns that it includes memory-saving tweaks specific to the AVR family of microcontrollers, which would need to be removed to port it to other microcontroller platforms.
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.