-->
Page 1 of 1

Blink wrong LED ?

PostPosted: Sat Oct 01, 2016 10:12 pm
by dave-in-nj
I had an odd problem with the LED's on my nodeMCU

using the Arduion blink sketch and I get the red LED on the nodeMCU board to flash as expetected.

it's the basic
Code: Select all  digitalWrite(16, HIGH);   
  delay(1000);             
  digitalWrite(16, LOW);   
  delay(100); 


and it does that quick flash followed by a 1 second pause.

but I wanted to try a switch light the LED.
Code: Select allint button = 2;  // D4 on the nodeMCU


void setup() {
  pinMode(16, OUTPUT);
  pinMode(button, INPUT);
}


void loop() {

  if (button = HIGH) {
    digitalWrite(16, HIGH);
  }

  digitalWrite(16, HIGH);   
  delay(1000);             
  digitalWrite(16, LOW);   
  delay(100);             
}


I would have bet that this would have effected the RED LED on the nodeMCU board.
but when I press the button and bring D4 to ground, the blue LED on the ESP board lights.

it appears that there is no coorelation to my sketch and that D4 lights the blue LED on the ESP board.

I'm using D1 and D2 for my I2C

any suggesttions ?