monteslu / node-red-contrib-gpio

A set of node-red nodes for connecting to johnny-five IO Plugins
MIT License
41 stars 31 forks source link

PWM frequency #31

Closed badfrogg closed 6 years ago

badfrogg commented 6 years ago

Can you explain how the PWM frequency is set Please? I have PWM in use on a Beaglebone Black and have no problem controlling the duty cycle but the frequency is at 2khz and I need to increase it to something above the audible range.

monteslu commented 6 years ago

so a little background, this project mostly just utilizes johnny-five under the hood. Johnny-five started out with Arduino support over serial cables using the firmata protocol. This gives us a bunch of apis like pwmWrite() which gives us a way to set the duty cycle, but not the frequency. The frequency is determined under the hood by the IO plugin johnny-five is using. In this case https://github.com/julianduque/beaglebone-io

I'm not sure if there's hardware APIs you can use to customize beaglebone-io for frequency, but if you can, you can use an edited/forked beaglebone-io with node-red-contrib-gpio and have access to the io variable in the johnny-five node.

badfrogg commented 6 years ago

Thanks for that explanation. I was trying to read your source code and was kinda seeing that but my JavaScript is still very amateur.

Ch3fk0ch88 commented 6 years ago

Did someone found a way to change the frequency?