Skip to main content

Add a driver

New drivers can be integrated into the devicescript GitHub repository or published as a npm package.

To get started and understand what needs to be done, look at existing drivers.

How to

/**
* Support for Badger 2040 W (Pico W Aboard)
*
* @url https://shop.pimoroni.com/products/badger-2040-w
* @devsPart Pimoroni Pico Badger
* @devsWhenUsed
*/
export class PimoroniBadger2040W { ... }

The documentation summary will be used as a title and DeviceScript will automatically extract this class using the @devsPart information.

  • add additional hardware configuration in the constructor
    constructor() {
configureHardware({
i2c: {
pinSDA: pins.GP4,
pinSCL: pins.GP5,
}
})
}
  • add helper function to start mount server on sensors
    startLED() {
return startLightBulb({
pin: pins.GP22,
dimmable: true,
})
}
  • add a main...ts in the samples project to easily try out the sensor
  • add a documentation page under website/docs/api/drivers
  • add a sample under website/docs/samples, the picture can be added to website/static/pics/samples
  • prepare a pull request and send away!
  • (optional) advertise your new sensors on your favorite dev/blog news channel :)