Skip to content

Wrong PWM resolution #271

Closed
Closed
@FernandoGarcia

Description

@FernandoGarcia

Hi!

In the versions above 2.6.3 the analogWrite function works with 8 bit resolution instead 10 bit.

Using the code below you will get 3.3 V instead 1.61 V on output.

#include "Arduino.h"

const int LED_PIN = D7;
const int PWM_VALUE = 500;

void setup()
{
  pinMode(LED_PIN, OUTPUT);
  analogWrite(LED_PIN, PWM_VALUE);
}

void loop()
{
}

Here some pics showing the problem.

Code:

230code

Platformio.ini using v3.2.0:

320ini

Oscilloscope measurements:

320osc

Platformio.ini using v2.6.3

263ini

Oscilloscope measurements:

263osc

Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions