Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

pwm

0.0.3 • Public • Published

pwm - API to use PWM gpio through /sys

Derived from https://github.com/EnotionZ/GpiO

Standard setup
var pwm = require("pwm");
 
// Calling export with a chip number and a pin number will export that
// header and return a pwm header instance
var pwm5 = pwm.export(0, 5, function() {
    console.log("Ready!");
});
API Methods
// Enable pin
pwm5.setEnable(1, function() {
    console.log("Enabled!");
});
// Set pin period
pwm5.setPeriod(1000000, function() {
    console.log("Period set!");
});
// Set pin duty cycle
pwm5.setDutyCycle(500000, function() {
    console.log("Duty cycle set!");
});
// Reset
pwm5.reset();
// unexport program when done
pwm5.unexport();

Keywords

Install

npm i pwm

DownloadsWeekly Downloads

5

Version

0.0.3

License

none

Last publish

Collaborators

  • avatar