Closed RobertCNelson closed 6 years ago
The JavaScript library should be asynchronous. What system event can I use to trigger the update rather than an arbitrary stall that could be unreliable?
can you loop over the dir? it should change from root:root -> root:pwm
The approach taken by beaglebone-io is to repeatedly access the files until there's no exception.
see https://github.com/julianduque/beaglebone-io/blob/v3.0.0/lib/pwm-output.js#L20-L53 and https://github.com/julianduque/beaglebone-io/blob/v3.0.0/lib/pwm-output.js#L98-L104
As mentioned in the comments it's a bit of a hack but it works.
This issue was moved to beagleboard/bonescript#44
Fix in Adafruit-lib: 100ms delay:
https://github.com/adafruit/adafruit-beaglebone-io-python/blob/master/source/c_pwm.c#L415-L418
On first startup, the pwm will fail in user mode:
However, If you re-run it, it works fine, as udev has had time to fix the permissions..