Hallo zusammen,
mein Servo hat das große Zittern:
Ich versuche ihn über das Control M32 Board des RP6 anzusteuern. Dabei verwende ich die Standard PWM Betriebsart des Timers 1 und der Servo liegt mit seiner Steuerleitung an PIND5.
Das Problem:
Der Servo dreht zwar wie befohlen, zittert aber mächtig.
Kann ich ihm das Zittern abgewöhnen ?
Viele Grüße
Igeligel
Hier mein Code:
Code:#include "RP6ControlLib.h" void initServo(void) { DDRD |= (1 << PD5); // define PIND5 as output TCCR1B |= (1 << CS12); // systemclock :256 TCCR1A |= (1 << COM1A1) | (1 << WGM11) | (1 << WGM11); // 9bit PWM-mode OCR1A = 26; // set compare value sei(); // enable interrupts } int main(void) { uint8_t counter=0; initRP6Control(); initServo(); startStopwatch1(); // Stopwatch1 starten! while(true) { // Check if a key is pressed: uint8_t key = getPressedKeyNumber(); // If button 1 is pressed => turn servo to the right if (key==1 || ch=='u') { OCR1A++; setStopwatch1(0); while(getStopwatch1() < 200) { counter++; } } // If button 2 is pressed => turn servo to the left if (key==2 || ch=='d') { OCR1A--; setStopwatch1(0); while(getStopwatch1() < 200) { counter++; } } // If no button is pressed => do nothing if (key==0) { } } }







Zitieren

Lesezeichen