Looks like there is an error in the documentation. analogWrite's callback
only sets x.err, not x.value. This worked for me:
(Note: I'm using pinMode b.ANALOG_OUTPUT rather than b.OUTPUT.)
var b = require('bonescript');
b.pinMode('P9_14', b.ANALOG_OUTPUT);
b.analogWrite('P9_14', 0.1, 2000.0, printStatus);
function printStatus(x) {
if(x.err) {
console.log('x.err = ' + x.err);
} else {
console.log('No errors');
}
}
--Mark
On Wednesday, May 25, 2016 at 11:59:02 PM UTC-4, Baozhu Zuo wrote:
>
> I have tested bonescript 0.5.0-beta7.
> run:
> var b = require('bonescript');
> b.pinMode('P9_14', b.OUTPUT);
> b.analogWrite('P9_14', 0.7, 2000.0, printStatus);
> function printStatus(x) {
> console.log('x.value = ' + x.value);
> console.log('x.err = ' + x.err);
> }
> output:
> Bonescript: initialized
> x.value = undefined
> x.err = error updating PWM freq and value: undefined, Error: ENOENT, no
> such file or directory 'undefined/duty_cycle'
>
> PWM still now work.
> 在 2016年5月26日星期四 UTC+8上午3:42:30,robert nelson写道:
>>
>>
>>
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/5ed110f0-02d4-4311-836f-9f6943152176%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.