-
Notifications
You must be signed in to change notification settings - Fork 1
NanoSDK
Tip
If you're using a Micro:bit and have access to a desktop computer you should check out the Visual Studio Extension which bypasses all limitations of MicroOS.
NanoSDK is the software that allows you to create MicroOS applications locally using the NanoCode App built into every stock MicroOS installation. In this guide, you'll learn about different commands, basic and advanced logic, compiling, and optimizations.
-
COMMAND [parameter]Full Name - Number Padding: All number parameters must be at least 3 characters long (e.g., 005).
- Line Limits: Each line is limited to 36 characters.
Important
Currently due to the current design of the on-screen keyboard, each line is limited to 36 characters. Working around this limitation is explained in Advanced Logic.
Warning
When writing code in a virtual machine, avoid using ~ and ยง as they will make your project save and compile incorrectly.
Basic commands are the bare-bones features of NanoSDK, often required for the app to function.
- Full Name: Define Application Name
- Description: Defines the application name listed in the library and title bar. Must be placed on the first line.
- Version: 2026.1
- Full Name: Define Application Icon
-
Description: Defines the application icon displayed in the library. Must be placed on the second line. In case of not having an icon asset, set it to
defaultto use the default MicroOS application icon. To define an asset set the parameter to the name of a write file containing an icon WITH the file extension. To learn how to create assets refer to the Creating Assets Section - Version: 2026.3 (Required in earlier versions with default parameter)
- Full Name: Application Submenu
- Description: Defines the application submenu. Must be defined on the third line. Can also be called later in code to dynamically change submenus.
- Version: 2026.1
- Full Name: Title X Position
- Description: Defines the application title X position. Must be defined on the fourth line.
- Version: 2026.1
- Full Name: Print
- Description: Displays a pop-up window with the inputted string.
- Version: 2026.1
- Full Name: End
- Description: Force closes the application. An optional error message can be added.
- Version: 2026.1
Basic logic mostly revolves around the IFB and LOP systems.
- Full Name: If Bracket Variable
-
Description: Triggers code if the variable condition is met (
eql,mor,les,moe,loe). - Version: 2026.3
- Full Name: If Bracket Button
-
Description: Runs code based on button state (
btna,btnb,dpdl,dpdr,dpdu,dpdd). States includedwnandndn. - Version: 2026.1
- Full Name: If Bracket Sprite
-
Description: Similar to
IFB varbut checks sprite data:psx,psy,psz,vsb. Includestchfor touch detection. - Version: 2027.1
- Full Name: If bracket end
- Description: Defines the end of the If Bracket.
- Version: 2026.1
- Full Name: Loop
-
Description: Beginning of a loop. Set to a number or
inffor infinite. - Version: 2026.1
- Full Name: Loop Exit
- Description: Escapes the loop it is currently in.
- Version: 2026.1
- Full Name: Loop End
- Description: Closes off the loop.
- Version: 2026.1
Assets let you add visual spice to your application and let you set its icon in the Library.
To create an icon you use the Write app and write hexadecimal numbers that correspond to colors with each line corresponding to a row of pixels.
The hexadecimal numbers correspond to the following colors.
0 = Transparency
1 = #FFFFFF
2 = #590094
3 = #7A00B3
4 = #0148EF
5 = #0091FF
6 = #803D00
7 = #B67CFE
8 = #008033
9 = #EF9EFF
A = #FF00AE
B = #FFAE00
C = #32008F
D = #969696
E = #373737
F = #000000
0AAAABB0
AA1AB1B3
AA11B133
AA11B133
AB1B1132
BB131122
BB133122
03332220
Variables let you store information for later reuse.
- Full Name: Define Variable
- Description: Defines a new variable. With the option to include a value.
- Version: 2026.3
- Full Name: Set Variable
- Description: Sets the variables value.
- Version: 2026.3
- Full Name: Variable Math
-
Description: Performs a mathematical operation on a variable and sets the variable to the result. Supported operations are
add,sub,mulanddiv. - Version: 2026.3
- Full Name: Variable Content Join
- Description: Appends a string (or the value of another variable) onto the end of a variable, and sets the variable to the result. The second parameter is not padded or wrapped in quotes โ just write the text directly, or a variable reference.
-
Example:
Sets
DVR greeting Hello VCJ greeting World
greetingtoHello World. - Version: 2026.3
-
Description: Any command that accepts a string or value can reference a variable's current value using
!VARIABLE_NAME!.-
Inside a string: wrap the name in
!on both sides, e.g.PRN Score: !score!prints the live value ofscoreinside the text. -
In place of a value: when the entire parameter is just the variable reference, the closing
!can be omitted, e.g.SVR total !score.
-
Inside a string: wrap the name in
- Version: 2026.3
Tools to bypass hardware limitations and register background event handlers.
- Full Name: Below
- Description: Allows writing longer commands/strings by extending to the line below (bypasses the 36-character limit).
- Version: 2026.1
- Full Name: Loop Below
-
Description: Creates a conditional loop. Expects an
IFBcondition on the line immediately following it (e.g.,IFB btn btna dwn). Runs continuously until the condition evaluates to false. - Version: 2026.1
- Full Name: When
-
Description: Registers an asynchronous background event listener. During initial execution, NanoSDK skips past
WHNblocks. Once registered, the runtime checks these blocks continuously in the background whenever the condition evaluates to true. -
Supported Conditions:
-
WHN sel [1-based index]: Triggers when specified ListGUI menu option is selected (001= 1st item,002= 2nd item). -
WHN btn [button] [state]: Triggers on button state (btna,btnb,dpdu,dpdd,dpdl,dpdrwith statedwn/ndn). -
WHN var [variable] [cmp] [value]: Triggers on variable comparison (eql,mor,les,moe,loe).
-
- Version: 2026.1
- Full Name: When End
-
Description: Closes off a
WHNevent listener block. - Version: 2026.1
- Status: Work in progress
- Version: 2027.1
Commands for managing list-based graphical interfaces.
Important
NanoSDK uses two different indexing systems depending on the command:
-
Item Data Commands (
LGS,LGV,LGR): Use 0-based indexing. The first menu item is index000, the second is001, and so on. -
Selection Events (
WHN sel): Uses 1-based indexing. Option001targets the first menu item,002targets the second menu item, etc.
- Full Name: Create ListGUI
-
Description: Initializes a ListGUI menu. Optional presets:
-
(None): Uses manual dimensions or system defaults (
$X: 80, Y: 58, W: 160, H: 97$ ). -
ful: Fullscreen preset ($X: 80, Y: 58, W: 160, H: 97$ ). -
scl: Scrollable preset ($X: 76, Y: 58, W: 151, H: 97$ ).
-
(None): Uses manual dimensions or system defaults (
- Version: 2026.2
- Full Name: ListGUI Position
- Description: Sets the center position of the ListGUI menu on screen.
- Version: 2026.1
- Full Name: ListGUI Dimensions
- Description: Sets width and height dimensions of the ListGUI menu.
- Version: 2026.1
- Full Name: ListGUI Options
- Description: Populates menu options from strings listed directly below the command.
- Version: 2026.1
- Full Name: ListGUI Set
-
Description: Overwrites item text at the specified 0-based index (
000= 1st item). - Version: 2026.1
- Full Name: ListGUI Value
-
Description: Writes item text at specified 0-based index (
000= 1st item) to target variable. - Version: 2026.3
- Full Name: ListGUI Remove
-
Description: Removes menu item at specified 0-based index (
000= 1st item). - Version: 2026.1
- Full Name: Destroy ListGUI
- Description: Clears items and destroys active ListGUI interface element.
- Version: 2026.1
- Full Name: ListGUI Highlight
-
Description: Sets item selection mode (
off,auto, or explicit 0-based index). - Version: 2026.1
- Full Name: ListGUI Theme
-
Description: Sets ListGUI color theme (
dfor dark,lfor light,mfor match system theme). - Version: 2026.2
- Full Name: ListGUI Scroll Bar
-
Description: Toggles visibility of the scroll bar indicator (
on/off). - Version: 2026.2
- Status: Work in progress
- Version: 2027.1
- Status: Work in progress
- Version: 2027.1
- Status: Work in progress
- Version: 2026.4
- Version: 2026.1 Compiling a NanoSDK app is simple:
- Hit the
Compilebutton in the NanoCode top bar. - Enter your desired name of the app file.
- Find your compiled app in User Files.
- Status: Work in progress
- Version: 2026.4
- Version: 2026.3 This is an example of a simple counter app thing.
DAN Counter
DAI counter.wrt
ASM main
TXP 020
DVR count 0
CLG ful
LGH auto
LGO str3
Count: !count!
Add
Reset
WHN sel 002
VRM count add 1
LGS 000 Count: !count!
WHN end
WHN sel 003
SVR count 0
LGS 000 Count: 0
WHN end
LOP inf
LOP end