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");
pwmExp.driverInit();
if (pwmExp.checkInit()) {
console.log('Oscillator sucessfull initialized');
} else {
console.error('Error with oscillator initializing');
}
pwmExp.setFrequency(50);
pwmExp.setupDriver(-1, 5.0, 0.0);
pwmExp.disableChip();
-
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
b156February 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.");
});