Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analogwrite to RGB LED on Nano ESP32 does not turn off completely #10534

Open
1 task done
ednieuw opened this issue Oct 28, 2024 · 2 comments
Open
1 task done

Analogwrite to RGB LED on Nano ESP32 does not turn off completely #10534

ednieuw opened this issue Oct 28, 2024 · 2 comments
Labels
Status: Community help needed Issue need help from any member from the Community. Type: 3rd party Boards
Milestone

Comments

@ednieuw
Copy link

ednieuw commented Oct 28, 2024

Board

Arduino Nano ESP32

Device Description

Arduino Nano ESP32

Hardware Configuration

No

Version

latest development Release Candidate (RC-X)

IDE Name

Arduino IDE 1.0 and 2.0

Operating System

Windows 11

Flash frequency

NA

PSRAM enabled

yes

Upload speed

NB Arduino settings in board

Description

The RGB LED keeps on faintly when it should be off when writing 512 to the analog port of the LED_RED, LED_GREEN or LED_BLUE

When writing 513 the LED colour turns off.
So there is an one bit discrepantie

Sketch

int Toggle=0;
void setup() {}
void loop() 
{
 UpdateStatusLEDs(Toggle);
 Toggle = 1 - Toggle;
 delay (1000);
}

//--------------------------------------------                                                //
// COMMON Update routine for the status LEDs
//-------------------------------------------- 
void UpdateStatusLEDs(int Toggle)
{
 if(Toggle)   
   {
    SetStatusLED(Toggle * random(100), Toggle * random(100), Toggle * random(100)); 
    analogWrite(48,  Toggle * 50);     
   }
   else
   {
    SetStatusLED(0,0,0); 
    analogWrite(48, 0);                                                               // on Nano ESP32 Turn the LED off    
   }
}
//--------------------------------------------
// COMMON Control the RGB LED on the Nano ESP32
// Analog range 0 - 512. 0 is LED On max intensity
// 512 is LED off. Therefore the value is subtracted from 512 
//--------------------------------------------
void SetStatusLED(int Red, int Green, int Blue)
{
 analogWrite(LED_RED,   512 - Red);                                                            // !Red (not Red) because 1 or HIGH is LED off
 analogWrite(LED_GREEN, 513 - Green);
 analogWrite(LED_BLUE,  513 - Blue);
}

Debug Message

none

Other Steps to Reproduce

With the Arduino Nano ESP32 core 2.0.18 the RGB turns off completely.
When using core 3.0.5 up to the latest core 3.1.0 RC2 this occurs.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@ednieuw ednieuw added the Status: Awaiting triage Issue is waiting for triage label Oct 28, 2024
@ednieuw
Copy link
Author

ednieuw commented Oct 28, 2024

What also not works correctly is the pin numbering when using the RGB LED and using LED_RED,LED_GREEN,LED_BLUE
It should be set to By GPIO number (legacy) and not By Arduino pin (default).

@P-R-O-C-H-Y P-R-O-C-H-Y added the Status: Community help needed Issue need help from any member from the Community. label Oct 29, 2024
@P-R-O-C-H-Y
Copy link
Member

@pillo79

@VojtechBartoska VojtechBartoska added Type: 3rd party Boards and removed Status: Awaiting triage Issue is waiting for triage labels Nov 4, 2024
@VojtechBartoska VojtechBartoska added this to the 3.1.0 milestone Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Community help needed Issue need help from any member from the Community. Type: 3rd party Boards
Projects
None yet
Development

No branches or pull requests

3 participants