2020-04-16, 04:49 PM
I've got it now. For if(pwm_style == 2) you need to modify two lines. Search for if(pwm_style == 2) and if below it mentions 16000, change it to a lower one. I've adjusted it to 1000 and the motor sound is perfect! In the newest motor.ino those are lines:
467: uint16_t OCR1A_u = 1000, OCR1B_u = 1000, ICR1_u = 1000;
482: ICR1_u=1000/DIV_CLOCK; //fPWM=1khz original was 16000, now 1000 is more khz
And of course, for the motor to work at all you need to define the proper board. In my case, even though i use an h-bridge i needed to define the VNH2SP30
119 #define VNH2SP30 // defined if this board is used
467: uint16_t OCR1A_u = 1000, OCR1B_u = 1000, ICR1_u = 1000;
482: ICR1_u=1000/DIV_CLOCK; //fPWM=1khz original was 16000, now 1000 is more khz
And of course, for the motor to work at all you need to define the proper board. In my case, even though i use an h-bridge i needed to define the VNH2SP30
119 #define VNH2SP30 // defined if this board is used