#include <dht.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SoftwareSerial.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

#define LOGO_WIDTH 128
#define LOGO_HEIGHT 64

#define RE 8
#define DE 7
 
//const byte code[]= {0x01, 0x03, 0x00, 0x1e, 0x00, 0x03, 0x65, 0xCD};
const byte nitro[] = {0x01,0x03, 0x00, 0x1e, 0x00, 0x01, 0xe4, 0x0c};
const byte phos[] = {0x01,0x03, 0x00, 0x1f, 0x00, 0x01, 0xb5, 0xcc};
const byte pota[] = {0x01,0x03, 0x00, 0x20, 0x00, 0x01, 0x85, 0xc0};
const byte ph[] = {0x01,0x03, 0x00, 0x06, 0x00, 0x01, 0x64, 0x0b};
const byte moisture[] = {0x01,0x03, 0x00, 0x12, 0x00, 0x01, 0x24, 0x0f};
const byte temp_hum[] = {0x01,0x03, 0x00, 0x12, 0x00, 0x02, 0x64, 0x0e};
const byte ec[] = {0x01,0x03, 0x00, 0x15, 0x00, 0x01, 0x95, 0xce};


byte values[11];
SoftwareSerial mod(2,3);


// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

dht DHT;

const unsigned char bitmap_logo [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xde, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0x3e, 0x9c, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0x9e, 0x3c, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0x9e, 0x3c, 0x7b, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x9b, 0x9e, 0x9e, 0x73, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xcb, 0x8f, 0xfe, 0x77, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe3, 0xff, 0xff, 0xe7, 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xfe, 0x79, 0xf3, 0xe0, 0x07, 0xef, 0x9e, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xfd, 0xfc, 0xff, 0x00, 0x00, 0xff, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0x7c, 0x00, 0x00, 0x3e, 0x7f, 0xbf, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0x38, 0x00, 0x00, 0x1c, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xf7, 0xe7, 0xe0, 0x07, 0x80, 0x07, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xef, 0xfb, 0xc0, 0x1f, 0xe0, 0x03, 0xfd, 0xd7, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xdf, 0x81, 0x80, 0x3f, 0xf0, 0x01, 0xc1, 0xfb, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xbf, 0x9f, 0x00, 0x3f, 0xff, 0x00, 0xf1, 0xfd, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xbf, 0xcf, 0x20, 0x7c, 0x3f, 0xc0, 0xf3, 0xfd, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0x7f, 0xf6, 0x30, 0x7e, 0x0f, 0x00, 0x67, 0xfe, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0x39, 0xff, 0xff, 0x80, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0x7c, 0x7c, 0x3b, 0xff, 0xff, 0xf0, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0x7f, 0x0c, 0x3f, 0xff, 0x7f, 0xc0, 0x1e, 0x3e, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0x7f, 0xd8, 0x31, 0xbf, 0xff, 0xe0, 0x1a, 0x3e, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0x7c, 0xd8, 0x00, 0x28, 0xc1, 0x18, 0x1a, 0xfe, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xfe, 0x18, 0x00, 0x80, 0x61, 0xf8, 0x18, 0xfe, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x41, 0x48, 0x00, 0x0f, 0xfe, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xbf, 0xf0, 0x00, 0x00, 0x28, 0x00, 0x0f, 0xfe, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xbf, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xbf, 0xf0, 0x00, 0x19, 0x10, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xbe, 0x70, 0x01, 0xe0, 0xe3, 0x80, 0x0e, 0x7d, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xbc, 0x70, 0x01, 0xff, 0xff, 0x80, 0x0e, 0x3d, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xfe, 0x70, 0x00, 0xff, 0xff, 0x00, 0x0e, 0x7d, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xdf, 0xf8, 0x00, 0x7f, 0xfe, 0x00, 0x1f, 0xfd, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xdf, 0xf8, 0x00, 0x7f, 0xfe, 0x00, 0x1f, 0xfb, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xdf, 0xf8, 0x00, 0x1f, 0xf8, 0x00, 0x1f, 0xfb, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xdf, 0xf8, 0x00, 0x05, 0xa0, 0x00, 0x1f, 0xfb, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xef, 0x9c, 0x00, 0x01, 0x80, 0x00, 0x3f, 0xf7, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xef, 0x0c, 0x00, 0x03, 0xc0, 0x00, 0x3f, 0xf7, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xee, 0xf6, 0x00, 0x01, 0xc0, 0x00, 0x70, 0x77, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xf2, 0xfe, 0x00, 0x01, 0xc0, 0x00, 0x71, 0xef, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xf7, 0x3f, 0x00, 0x03, 0xc0, 0x00, 0xf9, 0xef, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xf7, 0xfb, 0x80, 0x03, 0xc0, 0x01, 0xfc, 0xef, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xfb, 0xf3, 0xc0, 0x01, 0x80, 0x03, 0x9f, 0xdf, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xfb, 0xe6, 0xe0, 0x01, 0x80, 0x07, 0x8f, 0xdf, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xf9, 0xcc, 0xf0, 0x01, 0x80, 0x0e, 0x87, 0xbf, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xfd, 0xe1, 0xf8, 0x01, 0x80, 0x1c, 0x17, 0xbf, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xfd, 0xf7, 0x9e, 0x00, 0x00, 0x7e, 0x1f, 0x7f, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x1f, 0xc0, 0x03, 0xe7, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xd7, 0xfc, 0x3f, 0x87, 0xbe, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xcf, 0x3f, 0xff, 0xc7, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xde, 0x38, 0xf9, 0xc1, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xde, 0x3b, 0x71, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xfd, 0x3b, 0x30, 0xef, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0x3b, 0x76, 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xba, 0x77, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};

#define DHT11_PIN 52

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial3.begin(115200);
  Serial2.begin(9600);
  // if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
  //   Serial.println("SSD1306 allocation failed");
  //   for(;;);
    
  // }
  delay(2000);

  
  pinMode(RE, OUTPUT);
  pinMode(DE, OUTPUT);

  // display.setTextSize(1);
  // display.setTextColor(WHITE);
  // display.setCursor(0, 0);
  // testdrawbitmap();

}

void loop() {

  Serial.print("hello la team");
  int starttime = millis();

  byte nit,phos,pot, temp_h, pH, m, elec_cond;


  // put your main code here, to run repeatedly:
  int soil = analogRead(A0);
  int lum = analogRead(A1);

  int chk = DHT.read11(DHT11_PIN);

  int temp = DHT.temperature;
  int humidity = DHT.humidity;

  //soil = ((1023-soil)/1023)*100;

  int moist = map(soil,1020,25,0,100);
  int light = map(lum,1020,15,0,100);  
  //Serial3.println(soil);


  nit = nitrogen();
  // phos = phosphorous();
  // pot = potassium();
  // temp_h = temphum();
  // m = moistur();
  // elec_cond = eC();
  // pH = potHydr();

  Serial.flush();
  delay(500);

  Serial.print("nitrogen : ");
  Serial.println(nit);
  Serial.print("phosphorous : ");
  Serial.println(phos);
  Serial.print("potassium : ");
  Serial.println(pot);
  Serial.print("temp and humidity : ");
  Serial.println(temp_h);
  Serial.print("moisture : ");
  Serial.println(m);
  Serial.print("pH : ");
  Serial.println(pH);
  Serial.print("Eletrical condictivity : ");
  Serial.println(elec_cond);



  // Serial.print(moist);
  // Serial.print(","); 
  // Serial.print(light);
  // Serial.print(",");
  // Serial.print(temp);
  // Serial.print(",");
  // Serial.println(humidity);


  display.clearDisplay();
  display.setCursor(0, 20);
  display.print("moisture : ");
  display.println(moist);
  display.print("light : ");
  display.println(light);
  display.print("temperature : ");
  display.println(temp);
  display.print("humidity : ");
  display.println(humidity);
  display.display();

  delay(10000);
}

void testdrawbitmap(void) {
  display.clearDisplay();

  display.drawBitmap(
    (display.width()  - LOGO_WIDTH ) / 2,
    (display.height() - LOGO_HEIGHT) / 2,
    bitmap_logo, LOGO_WIDTH, LOGO_HEIGHT, 1);
  display.display();
  delay(5000);
}


byte nitrogen(){
  digitalWrite(DE,HIGH);
  digitalWrite(RE,HIGH);
  delay(10);
  Serial2.flush();  // wait for write complete
  digitalWrite(DE,LOW);
  digitalWrite(RE,LOW);
  for(byte i=0;i<7;i++){
  //Serial.print(mod.read(),HEX);
  values[i] = Serial2.read();
  Serial.print(values[i],HEX);
  }
  Serial.println();
  return values[4];
}


byte phosphorous(){
  digitalWrite(DE,HIGH);
  digitalWrite(RE,HIGH);
  delay(10);
  Serial2.flush();  // wait for write complete
  digitalWrite(DE,LOW);
  digitalWrite(RE,LOW);
  for(byte i=0;i<7;i++){
  //Serial.print(mod.read(),HEX);
  values[i] = Serial2.read();
  Serial.print(values[i],HEX);
  }
  Serial.println();
  return values[4];
}


byte potassium(){
  digitalWrite(DE,HIGH);
  digitalWrite(RE,HIGH);
  delay(10);
  Serial2.flush();  // wait for write complete
  digitalWrite(DE,LOW);
  digitalWrite(RE,LOW);
  for(byte i=0;i<7;i++){
  //Serial.print(mod.read(),HEX);
  values[i] = Serial2.read();
  Serial.print(values[i],HEX);
  }
  Serial.println();
  return values[4];
}


byte potHydr(){
  digitalWrite(DE,HIGH);
  digitalWrite(RE,HIGH);
  delay(10);
  Serial2.flush();  // wait for write complete
  digitalWrite(DE,LOW);
  digitalWrite(RE,LOW);
  for(byte i=0;i<7;i++){
  //Serial.print(mod.read(),HEX);
  values[i] = Serial2.read();
  Serial.print(values[i],HEX);
  }
  Serial.println();
  return values[4];
}


byte moistur(){
  digitalWrite(DE,HIGH);
  digitalWrite(RE,HIGH);
  delay(10);
  Serial2.flush();  // wait for write complete
  digitalWrite(DE,LOW);
  digitalWrite(RE,LOW);
  for(byte i=0;i<7;i++){
  //Serial.print(mod.read(),HEX);
  values[i] = Serial2.read();
  Serial.print(values[i],HEX);
  }
  Serial.println();
  return values[4];
}


byte temphum(){
  digitalWrite(DE,HIGH);
  digitalWrite(RE,HIGH);
  delay(10);
  Serial2.flush();  // wait for write complete
  digitalWrite(DE,LOW);
  digitalWrite(RE,LOW);
  for(byte i=0;i<7;i++){
  //Serial.print(mod.read(),HEX);
  values[i] = Serial2.read();
  Serial.print(values[i],HEX);
  }
  Serial.println();
  return values[4];
}


byte eC(){
  digitalWrite(DE,HIGH);
  digitalWrite(RE,HIGH);
  delay(10);
  Serial2.flush();  // wait for write complete
  digitalWrite(DE,LOW);
  digitalWrite(RE,LOW);
  for(byte i=0;i<7;i++){
  //Serial.print(mod.read(),HEX);
  values[i] = Serial2.read();
  Serial.print(values[i],HEX);
  }
  Serial.println();
  return values[4];
}

Here's my arduino code, and here's the answer : 

hello la teamFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000hello la teamFFFFFFFFFFFFFF
nitrogen : 255
phosphorous : 0
potassium : 0
temp and humidity : 0
moisture : 0
pH : 0
Eletrical condictivity : 0

Can you tell me why the sensor is only returning F's ?