Wemos Mega+Wifi+ESP8266 - Mega program works, ESP8266 program doesn't!

Using the board :Wemos® Mega +WiFi R3 Module ATmega2560+ESP8266 32Mb Memory USB-TTL CH340G Compatible For Arduino Mega NodeMCU ESP8266.

Running the following simple program (external DS12B80 temp probe), works correctly on Mega, BUT does not read probe on ESP8266/NodeMCU, despite same wiring. Dip switches set as needed for ESP. (off/off/off/off/on/on/off - RDX3).

Why would this happen? How do I get my simple probe program to work on ESP8266?

#include <DS18B20.h>
DS18B20 ds(2);

void setup() {
Serial.begin(9600);
}

void loop() {
while (ds.selectNext()) {
Serial.println(ds.getTempC());
}
}

What do you mean by "same wiring"?

Wemos Mega + ESP8266 is a single combined board, which you use the 7 DIP switches to connect to either the mega, the esp, or allow them to connect over serial3.

https://www.banggood.com/Wemos-Mega-WiFi-R3-ATmega2560ESP8266-32Mb-Memory-USB-TTL-CH340G-Compatible-For-Arduino-Mega-p-1205437.html

Wiring from board to sensors is not changed - but works perfectly when program on mega. ie. its not a sensor, nor wiring, nor mega issue, nor program issue. When program loaded / run on ESP8266 chip on the board, the sensors do not connect or the program causes the board to reset.

banaylor: Wiring from board to sensors is not changed - but works perfectly when program on mega.

There's your problem. The ESP8266 has separate pins from the ATmega2560. The DIP switches only control communication with the ESP8266. They don't do anything for the IO pins.

If you want to use the ESP8266 to read the sensor, you need to connect it to the ESP8266's GPIO pins. Those pins are on the 2x7 male header in the middle of the board: |239x500 Note that, unlike the ATmega2560, the ESP8266's GPIO pins can only be used with 3.3 V inputs. If you put the 5 V the ATmega2560 supports on the ESP8266's pins then you will destroy the ESP8266. Luckily, your DS18B20 can work at 3.3 V so you just need to be sure to power the DS18B20 from the 3.3 V pin when it's connected to the ESP8266.

Ah ok - makes sense. Need to look at that. Really appreciate.