Email Example Sketch with WeMos D1 Sheild - Wrong Pin Assignment?

Hi, I have a WeMos D1 board and used the example exactly as supplied here (great new feature by the way!)

The sketch worked fine, connected immediately to WiFi and Blynk servers (verified in Ser Mon). The startup email was sent as expected.

However the board did not detect button press on Pin 2 (the default pin defined in the Example sketch).

I decided to try different pins - Pin D9 on the WeMos D1 Shield triggered the 'Button is pressed." on SerMon and sent the email.

Why the different pins?


This often catches people out.
Digital Pin 2 in the sketch refers to General Purpose Input Output Pin 2 (usually referred to as GPIO2).
The manufacturers of the NodeMCU devices (including your Wemos D1 R1 Device) for some reason decided to give these different names.
If you look at a pin mapping diagram you’ll see that for your device GPIO2 is labelled D9.

You could refer directly to the NodeMCU pin assignment of D9 in your code, but that’s not backwards compatible with Arduinos.