fivdi / pigpio

Fast GPIO, PWM, servo control, state change notification and interrupt handling with Node.js on the Raspberry Pi
MIT License
948 stars 89 forks source link

ask for help #137

Closed Canees closed 2 years ago

Canees commented 3 years ago

Hello moderator: Can you come up with a use case for electronic speed controller? I am a novice do not understand how PWM is generated, tried a lot of methods

fivdi commented 3 years ago

I am a novice do not understand how PWM is generated, tried a lot of methods

What have you tried and what were the problems?

Canees commented 3 years ago

I am a novice do not understand how PWM is generated, tried a lot of methods

What have you tried and what were the problems?

Hi, sorry for taking so long to reply: for example: let speed = 0 let timer = setInterval(() => { speed++ if (speed > 3) { this.motor.servoWrite(Math.round(3 1000 / 7 + 1000)) clearInterval(timer) console.log('End of the calibration....') } else { this.motor.servoWrite(Math.round(speed 1000 / 7 + 1000)) console.log('In the calibration:', speed) } }, 2000); I am referring to the steering gear example given in the document,But using PWM for testing is useless, although I know it is used for leds。 The above example is very troublesome because the median value of each electrical modulation is different and cannot be automatically calibrated. Do you have any good suggestions?