loading

Problem!?

Hello! I am following the class. I am using a Node MCU and I have followed your steps wiring the led in the matching pins of my board because they are not the same. So my PIN13 is something called SD2 that according to different pinout images equals to PIN13.
What's more, your PIN4 is called D0 in my board but it actually equals to PIN4 too. So basically I have made the same connections (having in mind that my board has them in a different part but basically they are the same). So my problem is that when I upload the code, the led lights up and the onboard led flashes very fast at a low brightness and whenever I push the button it lights up with normal brightness.

What can cause this problem?

Thanks in advance!

sort by: active | newest | oldest
bekathwia1 month ago

It could be your wiring (forgetting to connect ground, etc), but I couldn't see the photo you uploaded, could you try again to show us your circuit?

Alexisgm97 (author)  bekathwia1 month ago

it seems that I can't upload a video. I'm going to try with some photos

IMG_20170616_105239[1].jpgIMG_20170616_105247[1].jpg

You're interpreting the pin numbers for the NodeMCU incorrectly. Here's a diagram:

http://www.c-sharpcorner.com/article/blinking-led-...

GPIO13 on NodeMCU is marked D7 (LED), GPIO4 is pin D2 (button). Try changing your wiring and the code should work!

zanod bekathwia1 month ago

I think I have the same problem. I'm also using the NodeMCU board. My button is connected to D7, which, on the pinout diagram, is GPIO13. The pin is high, and when I press the button, it goes low. Of course it does - it gets connected to ground!

I have stepped the wire connecting the LED all around the board, resetting the board after each movement of the wire. No position causes it to light when the button is pressed. It does light, of course, if I connect it to 3.3V (which proves the LED is the right way around, and is making a circuit to earth). There is one oddity, though, which looks just like the picture above from Alexis : if I connect the LED to D4 (GPIO2) then press the RESET button, my LED on the flying lead comes on, and the blue LED near the antenna on the board also comes on solid.

I can't make the flying LED come on when the button is pressed. If the board and program are working, I can only conclude that the switch is connected to the wrong pin - but it's not surprising we're confused - the numbering is all over the place. We are trying to correlate pinouts on the NodeMCU with those on the Feather, where a single pin, the one labeled "11" on the board, is designated "25", "PA16", "EXTINT0", "SC3PAD2", "TC3WO0", "TCC0WO2", and "10".

Well, I know pins can have multiple uses under different conditions, selections, etc, but there is no explanation for the confusion over "11", "25" and "10". I have no idea what they mean, or how to find the corresponding pins on the NodeMCU board, which has all different signal names.

BTW, the LED blinker from lesson 2 works perfectly.

bekathwia zanod29 days ago

The class uses the Adafruit Feather Huzzah ESP8266. The NodeMCU is my second favorite but not officially supported, and therefore has a factor of self-reliance in terms of pin configurations. I'm sorry you're frustrated! It's all pretty confusing stuff.

As you read in this lesson, some pins have special functions described in the pinout list ("GPIO2: 3.3V digital GPIO with built-in blue LED (which is also connected to the wifi antenna), internal pullup resistor connected, should not be low at startup to avoid bootmode"), which would explain your blue LED behavior on that pin.

Try wiring your circuit the way I recommended in the comment you're replying to: GPIO13 on NodeMCU is marked D7 (LED), GPIO4 is pin D2 (button)-- right now it sounds like you have it the other way around, which would indeed prevent the code from working.

zanod bekathwia29 days ago

Thanks Becky, In order to map out the IO pins, I repetitively recompiled the blink sketch, redefining the LED_PIN as 0, 1, 2, etc. Here's what I got

LED_PIN : Board marking

0 : D3
1 : TX
2 : D4 and Blue LED near antenna flashes in anti-phase.
3 : RX
4 : D2
5 : D1 (misprinted D2 on the board - there are two D2's)
6 : No flash (there is no GPIO6 pin)
7 : No flash (there is no GPIO7 pin)

8 : No flash (there is no GPIO8 pin)

9 : See note 1
10 : SD3
12 : D6
13 : D7
14 : D6
15 : D8
16 : D0 and Blue LED near USB plug in anti-phase

Note 1 : All of the above agree with the pinout diagram, where the LED_PIN number agrees with the GPIO number on the diagram - except this one.
The pinout diagram shows GPIO9 connected to the pin that is labeled SD2.

With the Blink sketch loaded for LED_PIN9, the LED on the flying lead and the blue LED near the antenna make a brief flash in unison approximately once every 7 seconds. The LED on the flying lead does not blink on and off once per second as called for by the sketch.

So now, I am certain of where the IO pins are, but I cannot make the press-to-light-LED sketch work. I must ask - is the sketch OK for the board I have?

It looks like a C program, but there is no main(), and the function loop() is never called. Also, there are pre-defined constructs like OUTPUT and INPUT_PULLUP that are not defined in the sketch, yet there are no #include<> statements either.

I must agree that it compiles and uploads onto the board, so I guess the Arduino software knows inherently where to look for its includes - but the sketch doesn't work as desired, and your comment is "don't move on till you get this working"

I'll do some experimentation (changing the input pin, etc.)

zanod zanod29 days ago

Sorry, Becka, I called you Becky before - habit from communicating with a Becky on another forum.

I got the sketch working with a different input pin, then came back to the sketch you gave, and it worked. I have no explanation of why it didn't work before.

Computers are supposed to be the epitome of logic, but they never do the same thing twice!

Ready to move on to the next lesson. Please mark this question "resolved"

bekathwia zanod29 days ago

It was certainly not wired properly for the code you were trying to run-- switching to the proper input (as I suggested twice) solved the problem. Please park your hubris at the door of my classroom, and next time start a new Q when you have one rather than continuing the thread of someone else's. Thank you!

bekathwia zanod29 days ago

If there's no setup and no loop, you haven't got the complete sketch-- perhaps a copy/paste error? No Arduino software I've ever used would compile and upload a sketch without a setup or loop-- can we see a screenshot of your arduino program with the code?

The code in this class will work with ESP8266 breakouts of all types including yours, compensating for pin layout differences.

As I already stated earlier, don't use the pin that flashes the blue wifi antenna LED-- it has a special function. On NodeMCU, use pin D7 for the LED (GPIO13), and pin D2 for the button (GPIO4) to work with the button code provided.