Derived from https://github.com/EnotionZ/GpiO
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!");
});
// 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();