// Library: Soil Moisture FC-28
// By: Devan Cakra M.W

#include "ESP_FC28.h" // library declaration

#define FC28PIN 15 // fc-28 pin declaration
#define wetSoil 60 // define the minimum value that is considered as 'wet' soil
#define drySoil 40 // define the maximum value that is considered as 'dry' soil
#define cbrValue 7 // define the value of calibration

FC28Sensor fc28(FC28PIN); // create a new object with the name fc28 to hold the FC28Sensor class

void setup() {
  Serial.begin(115200); // default baudrate for the ESP board
  fc28.begin(); // initiate fc-28 sensor
}

void loop() {
  fc28.calibration(cbrValue); // this is used to set the calibration of the FC-28 sensor
  fc28.getSoilMoisture(); // calls soil moisture data through the getSoilMoisture method
  fc28.limit(wetSoil,drySoil); // minimum limit for wet and maximum limit for dry
  fc28.viewData(); // print to serial monitor: soil moisture value & status
  delay(3000); // delay for 3 seconds
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
pot1:GND
pot1:SIG
pot1:VCC
r1:1
r1:2