ESP32_AnalogWrite icon indicating copy to clipboard operation
ESP32_AnalogWrite copied to clipboard

Not outputting correct voltage

Open adamelli opened this issue 4 years ago • 2 comments

#include <Arduino.h>
#include <analogWrite.h>

int brightStep = 1;
int brightness = 0;
uint8_t ledR = 34;
uint8_t ledG = 35;
uint8_t ledB = 32;
uint8_t ledW = 33;

void setup()
{

  // Set resolution for a specific pin
  analogWriteResolution(ledR, 12);
  analogWriteResolution(ledG, 12);
  analogWriteResolution(ledB, 12);
  analogWriteResolution(ledW, 12);

  analogWrite(ledR, 255);
  analogWrite(ledG, 255);  
  analogWrite(ledB, 255);
  analogWrite(ledW, 255);
 
}

void loop() {}

This outputs ledR = 0 = GPIO34 ledG = 0 = GPIO35 ledB = 1.6 V = GPIO32 ledW = 1.6 V = GPIO33

Why?

adamelli avatar Dec 08 '20 21:12 adamelli

So pins 34, 35, 36, 39 are input only. That does not explain why the other pins only output a maximum of 1.65 V...

adamelli avatar Dec 08 '20 23:12 adamelli

If you are measuring PWM with a standard VOM this would be normal. The duty cycle will throw off a conventional VOM. Set a pin HIGH and measure the voltage. If it's still just 1.65V then that would be an issue.

JimDrewGH avatar Oct 25 '21 10:10 JimDrewGH