Getting Started with smartBASIC

Created by Matthew Bon, last modified on Jan 12, 2017



Laird’s smartBASIC is an interpreted language that greatly simplifies firmware development on Laird’s various wireless modules. SmartBASIC is an enhancement of the original BASIC language and contains all the programming constructs of a modern language while still retaining BASIC’s simple syntax. A smartBASIC run time engine comes pre-programmed on most of Laird’s wireless modules allowing the user to quickly and easily use smartBASIC to create applications for these modules.

This article will demonstrate how to setup a smartBASIC development environment and create smartBASIC applications on a Windows PC.

Useful Links:

Laird Embedded Wireless Page
User Guide - smartBASIC Core Functionality.pdf (3.7 MB)

Setting Up Notepad++ to Edit smartBASIC Files:

While smartBASIC files can be created with pretty much any text editor, features such as syntax highlighting are very useful when creating large applications. This section will demonstrate how to enable smartBASIC syntax highlighting in Notepad++, which is a very flexible and powerful source code editor.

  1. Download Notepad++ from here:

  2. Navigate to the product page on the Laird website which corresponds to your chosen module, …ex this page for the RM1xx. At the bottom of the page, under the 'Software Downloads" tab, download the zip file. Unfortunately you will have to register for a Laird account to access this file.

  3. Once the file is downloaded, extract the zip file. Open the extracted folder and copy the smartBASIC(notepad++).xml file as shown below:

  4. Navigate to where you installed Notepad++ and paste the smartBASIC(notepad++).xml file in the folder as shown below:

  5. Open Notepad++, select ‘Language’ from the top menu and scroll down to 'Define your Language" and click on it. You should then see the following window:

  6. Select ‘Import’, and then select the smartBASIC(notepad++).xml file from the window and click ‘Open’. Once that is finished, close the ‘User Defined Language’ window and exit Notepad++.

  7. Re-open Notepad++ and select ‘Language’ from the top menu. Scroll down to the bottom of the menu and you should see “smartBASIC” listed as a language option.

  8. More information about enabling smartBASIC features in Notepad++ can be found here: Application Note - BL600 Using Notepad++ and Color Syntax Highlighting.pdf (245.3 KB)

A Simple smartBASIC Application in Notepad++:

Below is code for a simple toggle GPIO pin application. This code was written for the RM191 kit, so if you are using a different kit, you may want to change the GPIO pin number, which is the first argument in the gpiosetfunc() function. Once you have pasted the code into Notepad++, simply save the file with the extension ‘.sb’. SmartBASIC files can be given any extension, since the compiler ignores any characters in the filename after the ‘.’, however using the ‘.sb’ extension will make the smartBASIC files easier to keep track of.

Toggle GPIO

//Simple Toggle GPIO demo for the RM1xx
print "\nStart Demo\n"
dim i
dim pin_state
pin_state = gpiosetfunc(0,2,0) //Init pin0/D13 Low
while(1) //Loop forever
    WHILE i<400 //Delay
    i = i+1
    gpiowrite(0,1) //Write GPIO High
    i = 0
    WHILE i<400 //Delay
    i = i+1
    gpiowrite(0,0) //Write GPIO LOW
    i = 0

Setting Up UwTerminalX to Download Code to a Module:

  1. Ensure your chosen kit is plugged into your pc and that the usb drivers installed properly.

  2. Download the latest version of UwTerminalX from here : Releases · LairdCP/UwTerminalX · GitHub

  3. Extract the zip file and run the UwTerminalX.exe file.

  4. Under the config tab, configure the com port settings for your chosen device. Also, in the misc section under the config tab, ensure that the “Run Program’, “After Xcompile”, and 'Online Xcompile” options are checked. Click the ‘Ok’ button when finished. An example configuration for the RM191 device is shown below.

  5. Switch to the terminal tab, and click the ‘Open Port’ button

  6. In the terminal window, right click and select “Xcompile + Load + Run”, then select the .sb file that you want loaded into the module from the popup window.

  7. After the code loads properly, the terminal window should look like the following.


Hopefully this article helped you get started working with smartBASIC, any comments or questions about this article can posted here.