PMS3003 interfacing with arduino

I am having trouble interfacing PMS 3003 Particle Sensor with arduino to get the PM value. Its always showing zero even when there is data being transmitted into the serial buffer, but for some reason the checksum function is not giving the desired result.
Please help me out.
Following is the code :

#include <SoftwareSerial.h>
#define LENG 31   //0x42 + 31 bytes equal to 32 bytes
SoftwareSerial mySerial(10, 11); // RX, TX
unsigned char buf[LENG]; //register that stores 31 bytes
int PM01Value=0;          //define PM1.0 value of the air detector module
int PM2_5Value=0;         //define PM2.5 value of the air detector module
int PM10Value=0;         //define PM10 value of the air detector module
//#define Debug_Mode
void setup()
{
  Serial.begin(9600); 
   while (!Serial)
  {
    ; // wait for serial port to connect. Needed for native USB port only
  } 
  mySerial.begin(9600); // will communicate with device via pin 10,11
  mySerial.setTimeout(1500);  
}

void loop()
{
  if(mySerial.find(0x42)) // checks for the 1st byte 
  {   
   
    mySerial.readBytes(buf,LENG);  // starts reading the buf register
    
      
    if(buf[0] == 0x4d)  // checks if 2nd byte is 0x4d
    {
        if(checkValue(buf,LENG))  // checks the equality of the data sent and received 
      {
         
        PM01Value=transmitPM01(buf);  //transmits PM1.0 value after checking the 1st two bytes 0x42 & 0x4d
        //PM2_5Value=transmitPM2_5(buf); //count PM2.5 value "       "              "      "            "   
        //PM10Value=transmitPM10(buf);  //count PM10 value    "        "       "            "             "
        
      }           
    } 
  }
    static uint32_t t1=millis();  
    if (millis() - t1>=1000) 
    {
      t1=millis();
      Serial.print("PM1.0: ");  
      Serial.print(PM01Value);
      Serial.println("  ug/m3");            
    
      /*Serial.print("PM2.5: ");  
      Serial.print(PM2_5Value);
      Serial.println("  ug/m3");     
      
      Serial.print("PM1 0: ");  
      Serial.print(PM10Value);
      Serial.println("  ug/m3");   
      Serial.println("***************************************************************************************************************************************************"); */
     
       }
 
}



char checkValue(unsigned char *thebuf, char leng)  // checkvalue function call
{  
  char receiveflag=0;
  int receiveSum=0;
  for(int i=0; i<(leng-2); i++)   
  {
  receiveSum=receiveSum+thebuf[i];
  }
  
  receiveSum=receiveSum + 0x42;  // sum received by serial from the sensor data 
  

//----------------------------------------------------------------------------------------------------------------------
  #ifdef Debug_Mode
  for(int i=0; i<(leng); i++)
  {
  Serial.print("Buffer:  ");
  Serial.print(i);
  Serial.print(" :   ");
  Serial.println(thebuf[i]); 
  }  
  Serial.print("Receive Sum:  ");
  Serial.println(receiveSum);
  Serial.println("-----------------------------------------------------------------------------------");
  #endif
//-----------------------------------------------------------------------------------------------------------------------

  
  if(receiveSum ==((thebuf[leng-2]<<8)+thebuf[leng-1]))  //(thebuf[leng-2]<<8)+thebuf[leng-1])= sum calculated by the Sensor and sent to serial
  {
    receiveSum = 0;
    receiveflag = 1; // if data on both sides match 
  }
  return receiveflag;
  
}

int transmitPM01(unsigned char *thebuf) //transmit PM values to serial buffer
{
  
  int PM01Val=0;
  PM01Val=((thebuf[3]<<8) + thebuf[4]);    //count PM1.0 value 
  return PM01Val;
 
}

int transmitPM2_5(unsigned char *thebuf)
{
 int PM2_5Val;
 PM2_5Val=((thebuf[5]<<8) + thebuf[6]);   //count PM2.5 value 
 return PM2_5Val;       
}

int transmitPM10(unsigned char *thebuf)
{
  int PM10Val;
  PM10Val=((thebuf[7]<<8) + thebuf[8]);    //count PM10 value  
  return PM10Val;
}

Just to clarify things: This is not an Arduino forum but deals with Particle devices.

Although we do know our way round the Arduino world, going to the native Arduino forums might be a good choice - or even better, join the crowd of Particle users to get first class support :wink:

Whichever community you’ll ask, they probably would ask what info you get from the #ifdef Debug_Mode block.