-2

Hi can someone help with crating a pwm(or very similar) signal without analogwrite on the Arduino IDE because analogwrite wont work on the esp32.

And without using a library.

I need it to take values from 0 to 255.

I was thinking to use the second core one the esp32 but I have to control more than one pin.

RedRaptor
  • 92
  • 6
  • 1
    I’m voting to close this question because ["Can Someone Help Me" is not an actual question](https://meta.stackoverflow.com/a/284237/162698) – Rob Apr 17 '22 at 10:41
  • "Using the second core" is beyond *ESP32 as an Arduino* and the question or your problems with PWM or SoftPWM are not clear enough. – datafiddler Apr 20 '22 at 09:01

1 Answers1

1

you can create PWM pulse with delay or millis function. for example:

void setup()
{
  pinMode(13, OUTPUT);
}

void loop()
{
  digitalWrite(13, HIGH);
  delayMicroseconds(100);
  digitalWrite(13, LOW);
  delayMicroseconds(1000 - 100);
}

when you change the delay value, you can change duty-cycle level!

Alixahedi
  • 11
  • 2