           *pm10 = -1;
           return;
         }
-        if(Serial.available()){
-          data=Serial.read();
+        if(Serial1.available()){
+          data=Serial1.read();
           if(data==0x42 && !startcount){
             startcount = true;
             count++;


void retrievePM25Value(){
#ifdef USE_PM25_G3
  unsigned long timeout = millis();
  byte count=0;
  byte incomeByte[24];

}

long lastMsg = 0;
boolean firstmove = ture;
long loopcount;
void loop()
{ 
  Serial.print("loopcount:");
  Serial.println(loopcount);
  loopcount++;
  //Process Filter or any logic control below
  long now = millis();
  if(mqttclient.connected()){
    if (now - lastMsg > SENDLOOPTIME) {
      retrieveTempHumidValue();
      retrievePM25Value();
      lastMsg = now;
      sendMQTTMessage();
    } else if(firstmove) {
      lastMsg = now;
      sendMQTTMessage();
      firstmove = false; //run only once
    }
  } else {
    reconnectMQTT();
