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!) https://examples.blynk.cc/?board=WeMos%20D1&shield=ESP8266%20WiFi&example=Widgets%2FEmail

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?

thnx
billd

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.
https://community.blynk.cc/uploads/default/original/2X/f/f9b16315ae859e1b7f11c2a2780a798177ac6348.png

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

Pete.

2 Likes