user26515: I have multiple Arduino WeMos D1 boards, with a mix of versions bought months apart.  One of these boards is working but I need to update it and I am not sure if it is R1 or R2 (the pinouts are different).  I do not have physical access to it (it is 200+ miles away in an area that is locked down) but I can connect through another device over WiFi.
It has the following included:
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

#include <WiFiUdp.h>
#include <ArduinoOTA.h>

So, I can even browse to a Webserver to run commands.  How can I add to the code (or even replace it) to return a value that tells me which version the board is?  According to this you can do it with an AT command, but I am not sure how to pass an AT command from the WebServer interface (or any other way).
EDIT: I guess I may have confused the issue with my phrasing.  I can connect to the board and upload a new sketch (using OTA).  My question is, can I put something in a new sketch to determine the board details and upload it.  Once I get that, I can then put in a the actual sketch that I want.

user4143: There's nothing you can do with your currently loaded sketch. The board can only do exactly what you have programmed it to do and nothing more.

There are no "AT" commands. They only exist if you load the AT firmware instead of your own firmware
You can't magically make your code do things it wasn't programmed to do1

However the only real differences between the two boards is the version of the ESP8266 module in use: ESP-12E vs ESP-12F, (and the only difference between those modules is the layout of the PCB antenna in order to achieve FCC certification) and the addition of some unpopulated serial and I2C pins.
Aside from that the only other differences are purely cosmetic or of no consequence to your software.
So it really doesn't matter which board you have or which you compile your code for.

1: Unless you can cause some buffer overflow and inject new code into memory to execute, but to do that you'd need to be a l33t h4x0r.

Addendum:
It appears they have two boards, named the same, with different pin arrangements (both sadly very stupidly designed, but there you are).  All I can suggest is compile for one, install it, and see if it works. If it doesn't, then compile for the other and see if that works.
Or compile some special firmware that will probe what you have attached and work out what is attached where - then install and run that.

26515: <p>I have multiple Arduino WeMos D1 boards, with a mix of versions bought months apart.  One of these boards is working but I need to update it and I am not sure if it is R1 or R2 (the pinouts are different).  I do not have physical access to it (it is 200+ miles away in an area that is locked down) but I can connect through another device over WiFi.</p>
<p>It has the following included:</p>
<pre><code>#include &lt;ESP8266WiFi.h&gt;
#include &lt;WiFiClient.h&gt;
#include &lt;ESP8266WebServer.h&gt;
#include &lt;ESP8266mDNS.h&gt;

#include &lt;WiFiUdp.h&gt;
#include &lt;ArduinoOTA.h&gt;
</code></pre>
<p>So, I can even browse to a Webserver to run commands.  How can I add to the code (or even replace it) to return a value that tells me which version the board is?  According to <a href="https://arduino.stackexchange.com/q/47321/26515">this</a> you can do it with an AT command, but I am not sure how to pass an AT command from the WebServer interface (or any other way).</p>
<p>EDIT: I guess I may have confused the issue with my phrasing.  I can connect to the board and upload a new sketch (using OTA).  My question is, can I put something in a new sketch to determine the board details and upload it.  Once I get that, I can then put in a the actual sketch that I want.</p>
 4143: <p>There's nothing you can do with your currently loaded sketch. The board can <em>only</em> do exactly what you have programmed it to do and nothing more.</p>
<ul>
<li>There <em>are</em> no &quot;AT&quot; commands. They only exist if you load the AT firmware instead of your own firmware</li>
<li>You can't magically make your code do things it wasn't programmed to do<sup>1</sup></li>
</ul>
<p>However the only real differences between the two boards is the version of the ESP8266 module in use: ESP-12E vs ESP-12F, (and the <em>only</em> difference between those modules is the layout of the PCB antenna in order to achieve FCC certification) and the addition of some unpopulated serial and I2C pins.</p>
<p><s>Aside from that the only other differences are purely cosmetic or of no consequence to your software.</p>
<p>So it really doesn't matter which board you have or which you compile your code for.</s></p>
<hr />
<p><sup>1: Unless you can cause some buffer overflow and inject new code into memory to execute, but to do that you'd need to be a l33t h4x0r.</sup></p>
<hr />
<p><strong>Addendum:</strong></p>
<p>It appears they have two boards, named the same, with different pin arrangements (both sadly very stupidly designed, but there you are).  All I can suggest is compile for one, install it, and see if it works. If it doesn't, then compile for the other and see if that works.</p>
<p>Or compile some special firmware that will probe what you have attached and work out what is attached where - then install and run that.</p>
