Closed TechplexEngineer closed 9 years ago
However setting the pinMode to ANALOG_OUTPUT the code works as expected.
var b = require('octalbonescript'); //load the library
var pin = 'P9_14'; //the pin to operate on
var duty = .05;
var freq = 50;
function test(cb) {
b.pinMode(pin, b.ANALOG_OUTPUT, function (err) {
if (err)
console.log (err);
else {
b.analogWrite (pin, duty, freq, function(x) {
console.log(x);
if (cb)
cb(null);
});
}
});
}
test(function(){
test();
});
Yes, because b.OUTPUT means digital output and b.ANALOG_OUTPUT means PWM.
In the following test code calling the pinmode each time causes the output to be terminated.
Consider the following example:
However this works: