Skip to main content

Driver Scripts

The Driver Scripts provided for all modules gives you a set of user-friendly functions to access that module without needing to know much about the hardware or needing to look at any schematics. For example, SetLed(index, state) is a driver function for snowy to help in activating individual LEDs.

DueSTEM daisylinked to Snowy

Another example is an Accelerometer that uses SPI bus Standard Library internally to give you ReadX() acceleration.

tip

Driver scripts are directly related to the module they are loaded on. ReadX() might also be a function provided by a joystick module to read the joystick position in the X axis! But on an accelerometer ReadX() reads acceleration. Each module is free to how it uses drivers.

Driver Scripts and their API docs are listed under the Drivers tab on each product's page. While not required, inspecting the driver's script helps with a deeper understanding of the module's internal functionality.

tip

The internal engine limits available user functions. Driver scripts use some of these available slots. This is only relevant when needing to write advanced scripts.


Loading Drivers

You can use the Console to manually add/modify Regions and drivers. However, the online Loader has it all automated.

tip

It is required to always load/update the driver scripts after any firmware update. This is automated in the online loader.


Regions

We take advantage of the Region feature and load Driver Scripts into Region 0-Driver. This allows the user to load their own application into Region 1-User.

You can use the console's Region Panel to see and modify any of the regions.

Driver Button

The Console will now load and show region 0 content, which you can modify and write back. See Region for more details.


Driver Version

Driver scripts always include DVer() function that returns the driver's version number. If the function did not exist then the driver was not loaded!

You can access DVer() similar to all other functions, like from the Console immediate window for example.

Driver Version