Skip to content

djdeath/pwm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published