Skip to main content

hardware

Availability

Device

Description

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);

Member Entities

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: