rpio-l298n
Version:
Module to control an l298n motor controller on a Pi,dependencies rpio.
17 lines (15 loc) • 393 B
JavaScript
const rpio = require('rpio');
function PinPWM(pin,clock,range) {
this.pin = pin;
this.clock = clock;
this.range = range;
rpio.open(pin,rpio.PWM);
rpio.pwmSetClockDivider(clock);
rpio.pwmSetRange(pin, range);
}
Object.assign(PinPWM.prototype, {
setData : function (data) {
rpio.pwmSetData(this.pin, data);
}
});
module.exports = PinPWM;