Skip to content

dilshan/tiny-basic

Repository files navigation

Tiny Basic for Arduino

Tiny Basic for Arduino is a lightweight, fast, and fully featured BASIC interpreter designed for mid-range Arduino boards and other microcontroller targets. It lets you write, edit, and run BASIC programs directly on hardware, making it a practical choice for education, rapid prototyping, and embedded experimentation.

Overview

This project brings the familiar simplicity of BASIC to embedded development. With an in-hardware editor, a broad set of built-in functions, and support for multiple targets, Tiny Basic for Arduino is well suited for:

  • Teaching programming and embedded concepts.
  • Prototyping small control and automation projects.
  • Running BASIC scripts on supported Arduino boards.
  • Exploring MCU programming without needing a full desktop application / compiler.

Features

  • In-hardware editor for writing and editing BASIC programs directly on the device.
  • Support for common BASIC language constructs and control flow.
  • Built-in functions for math, I/O, bit manipulation, and timing.
  • Portable design that can be adapted to different MCU targets.
  • Native build support for local testing and debugging.

Getting Started

Prerequisites

To build the project, you will need:

  • Python 3
  • PlatformIO
  • bison and yacc
  • A C/C++ build toolchain such as build-essential.

On Debian/Ubuntu-based systems, install the required tools with:

sudo apt-get update
sudo apt-get install yacc bison build-essential
pip install -U platformio

Build for Arduino Due

The default environment targets the Arduino Due:

pio run -e due

To upload the firmware to a connected board:

pio run -e due -t upload

Build for the native host

This step is optional and is only required when you want to validate or test parser-related functionality on a desktop machine. Hardware-specific operations are not implemented in this mode, so calling those functions may lead to unexpected results or application crashes.

pio run -e native
./tinybasic.sh

First program

Once the interpreter is running on your board, you can start with a simple program such as:

10 PRINT("HELLO, WORLD!")
20 END

Run it with:

RUN

Documentation

The project documentation is available online at:

Building the documentation

The documentation is built with MkDocs. To generate the static HTML pages for the Tiny Basic home page and the rest of the documentation site, install the required Python packages and run the build command:

pip install -U mkdocs mkdocs-material
mkdocs build

This will generate the HTML output under the site/ directory, including the homepage and manual pages. For local preview while editing content, you can run:

mkdocs serve

Then open the local URL shown by MkDocs in your browser.

Additional documents

License

This project is licensed under the BSD 3-Clause License.

About

A fast, lightweight, and fully-featured BASIC interpreter for Arduino and mid-range microcontrollers.

Topics

Resources

License

Code of conduct

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Contributors