PWM doesnt produce regulated Voltage/erzeugt keine geregelte Spannung

Hi, i´m writing a code for an remote controlled car. But the PWM-Pins are not working as I want. The PIN only gives an Voltage of 5V at a Value of 255, with 254 the are only about 4 mV. The Pin is defined as Output, is an PWM Pin and i am using analogWrite to stear them. Has anybody an idea to solve this?
Thanks, Lars
Hi, bin gerade dabei einen Code für ein ferngesteuertes Auto zu schreiben. Leider funktionieren die PWM-Pins nicht wie sie sollen. Der Pin gibt nur bei einem Wert von 255 eine sinnvolle Spannung von 5V aus, schon bei 254 sinkt die Spannung auf etwa 4mV. Die Pins sind als Outputs definiert, sind PWM-Pins und ich steure sie über analogWrite an.
Hat jemand eine Idee was das Problem sein könnte?
Grüße Lars

Do you know what PWM is ?


yes of course, i have found the problem. I was using the servo library and the command "servo.attach" is causing that the analogWrite isnt working. I dont know why, but when i delete the line it works

Servo.h uses Timer1. The analogWrite commands also create the PWM via timer. If you use pins for PWM that also use Timer1 it doesn't work. Servo.h and analogWrite configure the timer in different ways.

Timer 1 of Uno controls PWM on pins 9 and 10.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.