Omega2 PWM-Expansion and Node.js

  • Hi, I'm working on an Omega2+ project.
    I took the following lines from the documentation but always get an exception on setupDriver.
    The PWM does something since the servo seems to be powered and the PWM library even outputs a line.
    Anyone experience with it?

    var pwmExp = require("/usr/bin/node-pwm-exp");

    if (pwmExp.checkInit()) {
    console.log('Oscillator sucessfull initialized');
    } else {
    console.error('Error with oscillator initializing');
    pwmExp.setupDriver(-1, 5.0, 0.0);


  • The python version of the code works fine.. guess there is a bug in the node library. Hope that's fixed soon.. hate working with py

  • i saw this today, not sure if it is connected to your issue.
    changelog snip

    February 16, 2017

    Overhauled Node modules for Relay, PWM, and OLED Expansions

  • I know this is an old topic, but I hope this will be useful to somebody. It would have saved me a couple of hours.

    Apparently the setupDriver, setFrequency and disableChip methods require a callback to function correctly.

    pwmExp.setupDriver(0,50,0, () => {
    console.log("setupDriver success.");

Log in to reply

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.