1

I made this simple piece of code, to make my LED flash.. Which it does when the pin is set low.. But how does that makes sense?

#include "pins_arduino.h"

void setup() {
  // put your setup code here, to run once:
  pinMode(BUILTIN_LED,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(BUILTIN_LED,LOW);
} 

I am using the Wemos d1 - http://www.wemos.cc/

  • That depends entirely on how the LED is wired up. How have you wired your LED? – Majenko Sep 19 '16 at 18:24
  • I am using a wemos d1 – Carlton Banks Sep 19 '16 at 18:29
  • What's a wemos d1? – Majenko Sep 19 '16 at 18:29
  • I am using this one wemos.cc/Products/d1_mini.html – Carlton Banks Sep 19 '16 at 18:30
  • I see no LED on the schematic. Do you mean the one built in to the ESP-12F module? – Majenko Sep 19 '16 at 18:32
0

If the LED is ON when LOW and OFF when HIGH then chances are the LED is connected between +3.3V and the IO pin with a suitable resistor.

When HIGH the IO pin is at +3.3V, so the voltage across the LED is 0V (3.3 - 3.3 = 0) and it is turned off. When LOW the IO pin is at (nearly) 0V and the voltage across the LED (and its resistor) is 3.3V (3.3 - 0 = 3.3), so it lights up.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.