Skip to main content





The hardware object provides your device code with a means to interact with any peripherals connected to the general-purpose IO pins and standard buses offered by the imp module integrated into your device. Generally, for accessing and controlling the functionality of the imp module itself, use the imp object.

The hardware object is instantiated automatically, as are all of the device’s hardware interface objects — pin, i2c, sampler etc — which are accessed as properties of the hardware object:

It is common practice to store a reference to any peripheral you use in a global variable or root-level local variable for convenience:

button <- hardware.pin8;
button.configure(DIGITAL_IN, 1);

You can use the hardware object to test for the availability of a specific pin or bus in the imp you are using in your device, or to test for a type of imp if your firmware is expected to run on different modules. For example, you can check for the imp003 by looking for the presence of a pin it possesses but other imps lack:

if ("i2cAB" in hardware) {
    // Code running on imp003/Murata LBWA1ZV1CD...

The hardware object has the following member methods:

The hardware object also has the following deprecated member methods, which should not be used in new code, but are documented here as an aid to understanding and migrating old code: