Soil moisture error: 'D1' was not declared in this scope

I tried this script to get my soil moisture sensor work and also to get some experience with the usage of thinger.io.

My wiring is like this:

ESP8266-----Soil moisture D1-----------DO D2-----------AO (is this even necassary?) 3V3----------VCC GND---------GND

But i always get this error message: exit status 1 'D1' was not declared in this scope

This error belong to line 16: #define SENSOR_PIN D1

On which environment with your ESP? Arduino? NodeMCU? AT commands?connected to an arduino?

Sounds like you did not select the correct board type in the Arduino IDE. That is the same error I get if I try to compile a sketch for Wemos (similar to Thinger) but forget to select Wemos as the board type and leave it set to Uno/Nano.

(deleted)

Sorry that i doesn't post specific information. And you were right, it was the wrong device in the Arduino IDE. I just installed the esp8266 under board management and selected 'generic esp8266 module'. But i was 'NodeMCU 1.0 (ESP-12E Module)'. I changed this mistake and now everything works fine. Thank you both!

spycatcher2k: D0 = 0 D1 = 1

They are just telling you they are Digital pins.

No, D0 and D1 do not have those values. They are GPIO16 and GPIO5 on esp based boards, so D0=16 and D1=5.

D2-----------AO (is this even necassary?)

No, if you are using the digital output of the sensor, you don't need to connect anything to AO and vice versa.

(deleted)