logo elektroda
logo elektroda
X
logo elektroda

Difference in button state memory between Arduino Leonardo and ESP8266

zagiewa 705 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19033612
    zagiewa
    Level 7  
    Hi. I have a piece of code that works perfectly on the Arduino Leonardo while on the ESP8266 it no longer works. Here is the code:
    Code: C#
    Log in, to see the code
    .

    On the Arduino Leonardo and ESP8266 I have two cables connected to pin 4 and GND.
    On the Arduino Leonardo, when I short-circuit the cables, the LED on the board lights up and stays on until I short-circuit the cables again to make it go out (it remembers the state). On the ESP the LED only lights up when the cables are shorted and does not remember the state.

    Why the difference? What can be done to make the ESP behave the same as the Leonardo in this particular case?
  • ADVERTISEMENT
  • #2 19033684
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #3 19033775
    zagiewa
    Level 7  
    Specifically, it is a NodeMcu V3 and the button is connected to D4
  • ADVERTISEMENT
  • Helpful post
    #4 19033781
    Anonymous
    Level 1  
  • #5 19036666
    krzbor
    Level 28  
    I don't know who when designing the NodeMCU came up with this "fantastic" idea of numbering the pins differently. As soon as I read the topic I immediately thought of this problem. Even more "killer" is the Wemos D1 Mini - the leads are almost like on the ESP-12, but GPIO15 has been flipped to the other side. And where GND should be is 5V.
ADVERTISEMENT