These are chat archives for nebrius/raspi-io

27th
Nov 2015
Tiago Alves
@tralves
Nov 27 2015 02:41
Hi! I took my time but got this to the point where I have a new module raspi-soft-pwm. It uses pigpio.
It works too! I got my pi2go motors to work with it.
I still need to implement more initialization options, clean the code a bit and implement more functions.
Tiago Alves
@tralves
Nov 27 2015 02:51
Currently it only has the writeAnalog (analogWrite) function, but the pigpio API has lots more:
getPwmDutyCycle(), pwmRange(range), getPwmRange(), getPwmRealRange(), pwmFrequency(frequency), getPwmFrequency()
I think that these should only be used for initialisation stuff. The only function that should be exposed is writeAnalog (maybe change to simply "write").
I'd love to hear your thoughts. Soon I'll post my code on github.
Brian Cooke
@fivdi
Nov 27 2015 10:17
@tralves Sounds good :smile:
Brian Cooke
@fivdi
Nov 27 2015 10:26
I haven't seen the code, but it sounds like you have what Johnny-Five needs (analogWrite.) However, raspi, which raspi-io depends on, and which will include your module, can offer additional functionality. @nebrius will need to decide how to proceed here.
Tiago Alves
@tralves
Nov 27 2015 12:51
@fivdi yup. After raspi-soft-pwm module is complete, there I want to use it from johnny-five. I can't figure out how this works.
Brian Cooke
@fivdi
Nov 27 2015 14:18
For the Johnny-Five side of things one approach would be to integrate raspi-soft-pwm into raspi-io the same way that raspi-pwm is integrated. Then in would be necessary to modify the appropriate pieces of code in https://github.com/nebrius/raspi-io/blob/master/index.js to use raspi-soft-pwm rather than raspi-pwm. At least that's how I'd approach it.
Tiago Alves
@tralves
Nov 27 2015 14:41
Should raspi-soft-pwm completely replace raspi-pwm? raspi-pwm works fine for the "native" pwm pin (pin 0, I think), and probably should be used when possible.
Brian Cooke
@fivdi
Nov 27 2015 15:51
It could completely replace it for the Johnny-Five use case (raspi-io). raspi-pwm would still be there for the non Johnny-Five use case. However, your suggestion would also be possible and is also a valid approach.