Skip to content

NanoSDK

Cryptid edited this page Aug 23, 2026 · 58 revisions

NanoSDK Documentation

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.

๐Ÿ“ Introduction

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.

โŒจ๏ธ Syntax Conventions

  • 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

Basic commands are the bare-bones features of NanoSDK, often required for the app to function.

DAN [name]

  • 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

DAI [asset name]

  • 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 default to 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)

ASM [name]

  • 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

TXP [x position]

  • Full Name: Title X Position
  • Description: Defines the application title X position. Must be defined on the fourth line.
  • Version: 2026.1

PRN [string]

  • Full Name: Print
  • Description: Displays a pop-up window with the inputted string.
  • Version: 2026.1

END [error]

  • Full Name: End
  • Description: Force closes the application. An optional error message can be added.
  • Version: 2026.1

๐Ÿง  Basic Logic

Basic logic mostly revolves around the IFB and LOP systems.

IFB var [variable name] [comparison type] [comparison value]

  • Full Name: If Bracket Variable
  • Description: Triggers code if the variable condition is met (eql, mor, les, moe, loe).
  • Version: 2026.3

IFB btn [button] [button state]

  • Full Name: If Bracket Button
  • Description: Runs code based on button state (btna, btnb, dpdl, dpdr, dpdu, dpdd). States include dwn and ndn.
  • Version: 2026.1

IFB spr [variable] [comparison type] [comparison value]

  • Full Name: If Bracket Sprite
  • Description: Similar to IFB var but checks sprite data: psx, psy, psz, vsb. Includes tch for touch detection.
  • Version: 2027.1

IFB end

  • Full Name: If bracket end
  • Description: Defines the end of the If Bracket.
  • Version: 2026.1

LOP [number]

  • Full Name: Loop
  • Description: Beginning of a loop. Set to a number or inf for infinite.
  • Version: 2026.1

LOP EXT

  • Full Name: Loop Exit
  • Description: Escapes the loop it is currently in.
  • Version: 2026.1

LOP end

  • Full Name: Loop End
  • Description: Closes off the loop.
  • Version: 2026.1

๐ŸŽจ Creating Assets

Assets let you add visual spice to your application and let you set its icon in the Library.

The Basics

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.

Palette

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

Example App Icon (8x8)

0AAAABB0
AA1AB1B3
AA11B133
AA11B133
AB1B1132
BB131122
BB133122
03332220

๐Ÿงฎ Variables

Variables let you store information for later reuse.

DVR [variable name] [value]

  • Full Name: Define Variable
  • Description: Defines a new variable. With the option to include a value.
  • Version: 2026.3

SVR [variable name] [new value]

  • Full Name: Set Variable
  • Description: Sets the variables value.
  • Version: 2026.3

VRM [variable name] [operation] [number]

  • Full Name: Variable Math
  • Description: Performs a mathematical operation on a variable and sets the variable to the result. Supported operations are add, sub, mul and div.
  • Version: 2026.3

VCJ [variable name] [text or variable]

  • 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:
    DVR greeting Hello
    VCJ greeting  World
    Sets greeting to Hello World.
  • Version: 2026.3

๐Ÿ”— Variable Referencing (!VARIABLE_NAME!)

  • 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 of score inside 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.
  • Version: 2026.3

๐Ÿš€ Advanced Logic

Tools to bypass hardware limitations and register background event handlers.

[string]:BLW

  • Full Name: Below
  • Description: Allows writing longer commands/strings by extending to the line below (bypasses the 36-character limit).
  • Version: 2026.1

LOP :BLW

  • Full Name: Loop Below
  • Description: Creates a conditional loop. Expects an IFB condition on the line immediately following it (e.g., IFB btn btna dwn). Runs continuously until the condition evaluates to false.
  • Version: 2026.1

WHN [condition_type] [parameters...]

  • Full Name: When
  • Description: Registers an asynchronous background event listener. During initial execution, NanoSDK skips past WHN blocks. 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, dpdr with state dwn/ndn).
    • WHN var [variable] [cmp] [value]: Triggers on variable comparison (eql, mor, les, moe, loe).
  • Version: 2026.1

WHN end

  • Full Name: When End
  • Description: Closes off a WHN event listener block.
  • Version: 2026.1

๐Ÿ‘พ Sprite Commands

  • Status: Work in progress
  • Version: 2027.1

๐Ÿ“ƒ ListGUI Commands

Commands for managing list-based graphical interfaces.

Important

๐Ÿ”ข Indexing Rules

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 index 000, the second is 001, and so on.
  • Selection Events (WHN sel): Uses 1-based indexing. Option 001 targets the first menu item, 002 targets the second menu item, etc.

CLG [preset]

  • 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$).
  • Version: 2026.2

LGP [X] [Y]

  • Full Name: ListGUI Position
  • Description: Sets the center position of the ListGUI menu on screen.
  • Version: 2026.1

LGD [Width] [Height]

  • Full Name: ListGUI Dimensions
  • Description: Sets width and height dimensions of the ListGUI menu.
  • Version: 2026.1

LGO str[Amount]

  • Full Name: ListGUI Options
  • Description: Populates menu options from strings listed directly below the command.
  • Version: 2026.1

LGS [Index] [Value]

  • Full Name: ListGUI Set
  • Description: Overwrites item text at the specified 0-based index (000 = 1st item).
  • Version: 2026.1

LGV [Index] [Variable]

  • Full Name: ListGUI Value
  • Description: Writes item text at specified 0-based index (000 = 1st item) to target variable.
  • Version: 2026.3

LGR [Index]

  • Full Name: ListGUI Remove
  • Description: Removes menu item at specified 0-based index (000 = 1st item).
  • Version: 2026.1

DLG

  • Full Name: Destroy ListGUI
  • Description: Clears items and destroys active ListGUI interface element.
  • Version: 2026.1

LGH [Mode]

  • Full Name: ListGUI Highlight
  • Description: Sets item selection mode (off, auto, or explicit 0-based index).
  • Version: 2026.1

LGT [Theme]

  • Full Name: ListGUI Theme
  • Description: Sets ListGUI color theme (d for dark, l for light, m for match system theme).
  • Version: 2026.2

LSB [on/off]

  • Full Name: ListGUI Scroll Bar
  • Description: Toggles visibility of the scroll bar indicator (on/off).
  • Version: 2026.2

๐Ÿ“ป Radio Commands

  • Status: Work in progress
  • Version: 2027.1

๐Ÿ”Œ Device Management Commands

  • Status: Work in progress
  • Version: 2027.1

๐ŸŽจ Assets

  • Status: Work in progress
  • Version: 2026.4

๐Ÿ“ฆ Compiling

  • Version: 2026.1 Compiling a NanoSDK app is simple:
  1. Hit the Compile button in the NanoCode top bar.
  2. Enter your desired name of the app file.
  3. Find your compiled app in User Files.

โšก Optimizations

  • Status: Work in progress
  • Version: 2026.4

๐Ÿ“š Examples

  • 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

Clone this wiki locally