Es gab mal ein ähnliches Problem.
Hier der Code:Und zwar von hier: https://forum.arduino.cc/index.php?P...opic=366453.15Code:const byte PWMUhv = 3; // Spannung für Treiber const byte PWMUdesat = 11; // Spannung für Desat void initTimer2PWM() { TCCR2B= _BV(CS21); //prescaler8=3,9KHz; CS22=0; CS21=1; CS20=0; Timer2 TCCR2A= _BV(WGM21) | _BV(WGM20) | _BV(COM2A1) | _BV(COM2B1)| _BV(COM2A0)| _BV(COM2B0); OCR2B= 128; //Duty 50% für Pin 3 } void setup() { pinMode(PWMUhv, OUTPUT); // PWMUhv als Ausgang deklariert pinMode(PWMUdesat, OUTPUT); // PWMUdesat als Ausgang deklariert initTimer2PWM(); } int nacheilung = 0; void loop() { OCR2A= 128 + nacheilung; delay(200); nacheilung++; if(nacheilung>100) nacheilung = 0; }
MfG
Moppi







Zitieren

Lesezeichen