-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Describe the bug
The logic on "digitalWrite(LED_BUILTIN, 0)" is inverted, when I use an external led it works, but for the LED_BUILTIN it turns OFF the led with 1 and ON with 0.
To Reproduce
`#define botaoLigaDesliga A3
short ligado = 0;
unsigned long tempoPassadoBotao = 0;
void setup() {
pinMode(botaoLigaDesliga, INPUT_PULLDOWN);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, ligado);
}
void loop() {
if (digitalRead(botaoLigaDesliga)) {
if (millis() - tempoPassadoBotao >= 2000) {
if (ligado) {
ligado = 0;
} else {
ligado = 1;
}
digitalWrite(LED_BUILTIN, ligado);
tempoPassadoBotao = millis();
Serial.print("Botão apertado - ");
Serial.println(ligado);
}
}
}`
Steps to reproduce the behavior:
- Plug.
- Press BTN on A3 to change the state of the led.
- See on serial the 0 or 1 and compare with the led.
Expected behavior
The led needs to be OFF with 0 and on with 1.
Desktop (please complete the following information):
- OS: Windows 10
- Arduino IDE version: [e.g. 2.3]
- STM32 core version: [e.g. 2.9]
Metadata
Metadata
Assignees
Labels
No labels