Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

PWM channels of ESP32 #2660

Copy link
Copy link
Closed
Closed
Copy link
@mimansamaheshwari

Description

@mimansamaheshwari
Issue body actions

Hardware:

Board: ESP32 Dev Module
Core Installation/update date: 11/jul/2017
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Windows 8.1

Description:

I want to use 10 PWM channels of ESP32 for certain a task. I found no issue in working with 8 PWM channels at a time but as soon as I configure the 9th channel it does not work correctly. I am sharing a code that should change PWM of 10 channels after small delays. Is there anything wrong done by me in configuring channels?

Sketch:

int pin1 = 2;
int pin2 = 4;
int pin3 = 5;
int pin4 = 12;
int pin5 = 13;
int pin6 = 14;
int pin7 = 15;
int pin8 = 18;
int pin9 = 19;
int pin10 = 21;
void setup() {
  // put your setup code here, to run once:
  for (int i = 0 ; i < 10; i++)
  {
    ledcSetup(i, 50, 8);                      //50Hz , 8 bit
  }
  ledcAttachPin(pin1, 0);
  ledcAttachPin(pin2, 1);
  ledcAttachPin(pin3, 2);
  ledcAttachPin(pin4, 3);
  ledcAttachPin(pin5, 4);
  ledcAttachPin(pin6, 5);
  ledcAttachPin(pin7, 6);
  ledcAttachPin(pin8, 7);
  ledcAttachPin(pin9, 8);
  ledcAttachPin(pin10, 9);

}

void loop() {
  // put your main code here, to run repeatedly:
  for (int i = 0; i < 10; i++)
  {
    ledcWrite(i, 255);
  }
  delay(2000);
  for (int i = 0; i < 10; i++)
  {
    ledcWrite(i, 128);
  }
  delay(2000);
  
  for (int i = 0; i < 10; i++)
  {
    ledcWrite(i, 0);
  }
  delay(2000);
  
}

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.