Macro Microcontroller BASIC Programming Guide
Macro Microcontroller BASIC is an interpreter based on the BASIC language for microcontroller development boards, specifically the Macro Microcontroller.
Installation
First, download macro-microcontroller-basic-0.0.3.uf2 from releases. Current version: 0.0.3
Next, plug in your development board while holding the Boot button. A storage drive will appear on your computer.
Move macro-microcontroller-basic-0.0.3.uf2 into the storage drive. Your development board is now running Macro Microcontroller BASIC!
Install a serial terminal application on your computer and connect it to the board. If successful, you should see the following:
Macro Microcontroller BASIC Version 0.0.3.
Copyright (C) 2025-2026 Nicholas Lim.
521928 bytes of RAM free.
Ready.
10If not, try sending
PRINT "It works!". If "It works!" is sent back to the serial terminal, you have successfully installed Macro Microcontroller BASIC.
Syntax
Macro Microcontroller BASIC's syntax is similar to most other versions of BASIC:
10 <STATEMENT> <VALUE/ASSIGNMENT>
Note: Line numbers are automatically appended by the interpreter.
Statements
PRINT: Outputs text to the serial terminal.LET: Assigns a value (integer, float or string) to a variable.INPUT: Assigns a value (integer, float or string) to a variable via user input.GPIO: Turns on a specified GPIO pin for 1 second.LSVAR: Outputs variable name and their value to the serial terminal.END: Clears variable and reset line numbers.EXIT: Puts the device into sleep/power off mode.KEY: Pass GPIO controls to the macropad.REM: Add comments to your program.
Predefined Values
IO*: Set GPIO pins 1, 2 or 3 to high.LED*: Set LEDs 1, 2 or 3 to high.BELL: Sounds the builtin buzzer.MOTOR: Sets motor pins to high.RND: Generates a random floating-point integer less than 1.
Example Programs
Note: line numbers are automatically appended, hence there is no need to add them.
Example 1: Hello world!
PRINT "hello world!"
ENDExample 2: Activate buzzer and motor
GPIO BELL
GPIO MOTOR
ENDExample 3: Random floating-point number
PRINT RND
ENDExample 4: Assigning variables
LET X = 5
LSVAR
ENDExample 5: Reading input
INPUT Name
PRINT "Hello, "
PRINT Name
END