smartBASIC is an implementation of a structured BASIC programming language optimized for use on low-cost embedded systems with limited memory by being highly efficient in terms of memory usage. The BASIC programming language has been around for over 40 years in many variants and platforms, a good background and introduction is available at http://en.wikipedia.org/wiki/BASIC.
smartBASIC was designed to make BLE (Bluetooth Low Energy), or Bluetooth® Smart technology, development quicker and simpler, vastly cutting down time to market. The following are three good reasons for writing applications in smartBASIC:
Sample smartBASIC applications are available for download in the BL600 or BT900 Firmware Files in the Laird Bluetooth Download Center. Click here to view the BL600 User's Manual or click here to view the BT900 User's Manual. Current smartBASIC applications include:
|Blood Pressure||Buzzer Jungle||Heart Rate||Low Power / Deep Sleep||Temperature Sensor||iBeacon|
|LED Button Test||Read Supply Voltage||Health Thermometer||Proximity||UART Close||PWM|
|Buzzer Test||FindMe||Hello World||Trimpot Test||vSP - Virtual Serial Port (upass)|
The BL600 or BT900 BLE module running smartBASIC has two different modes of operation:
By default, the module starts up in Interactive mode and checks to see if an application called $autorun$ exists in the file system. If present, it automatically runs unless the nAutoRUN input pin is used to signal that the module should skip that step. If the autorun application exits, which in virtually all cases is not the case, then the module returns to Interactive mode. It is possible to write autorun applications that continue to run to control the module’s behavior until power-down, which provides a complete embedded application.
Being a structured programming language, smartBASIC offers typical modern constructs such as subroutines, functions, while, if, and for loops. Applications written in smartBASIC are event-driven rather than the sequential processing seen in early versions of BASIC.
A typical smartBASIC application source code consists of the following:
The source code ends with WAITEVENT, a final statement which never returns. Once the run-time engine reaches the WAITEVENT statement, it waits for events to happen and, when they do, it calls the appropriate handlers (written by the user) to service them.
The core language, which is common throughout all smartBASIC implementations, provides the standard functionality of any program, such as:
smartBASIC applications can be written in any standard text editor such as textpad or Notepad++ and do not require a complex or costly development environment. If you prefer syntax color highlighting, then treating the source as C or BASIC will display the code with color highlights. Applications are transferred to the module using a simple free terminal program called UWTerminal (available for download from www.lairdtech.com/wireless). Customers are able to develop their own utilities to download precompiled applications as the process involves the use of standard AT commands.