We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e252c1 commit 9ce616bCopy full SHA for 9ce616b
Arduino_Pedelec_Controller/Arduino_Pedelec_Controller.ino
@@ -494,6 +494,14 @@ void setup()
494
motorservo.attach(throttle_out);
495
#endif
496
497
+//increase PWM frequency
498
+#if HARDWARE_REV >= 20
499
+ int myEraser = 7;
500
+ TCCR4B &= ~myEraser; //reset timer 4 prescaler
501
+ int myPrescaler = 1;
502
+ TCCR4B |= myPrescaler; //set timer 4 prescaler to 001 --> 32 kHz PWM frequency on motor output pin
503
+#endif
504
+
505
#ifdef DEBUG_MEMORY_USAGE
506
Serial.print(MY_F("memFree after setup:"));
507
Serial.print(memFree());
@@ -1412,4 +1420,4 @@ int analogRead_noISR(uint8_t pin) //this function makes sure that analogRead is
1412
1420
analogRead_in_use = false;
1413
1421
1414
1422
return temp;
1415
-}
1423
+}
0 commit comments