 	Serial.print(N1000);
 	Serial.print("\t");
 	//Distance from Range Finder
-	Distance=sonar.ping_cm();
+	int uS = sonar.ping_median(10);
+	Distance=uS/US_ROUNDTRIP_CM;
 	Serial.print(Distance);
 	Serial.print("\t");
 	//Serial.println("Distance Done");

#define DHT22_PIN 7 // Pin where the DHT22 is connected
//Ultrasonic range finder
#include <NewPing.h>
#define TRIGGER_PIN 5
#define ECHO_PIN 6
#define MAX_DISTANCE 200
//PMS3003 definitions
#include <SoftwareSerial.h>

	dustport.begin(9600);
	//Set the analog read pin modes
	pinMode(A0,INPUT);
	Serial.println(F("Initialisation done."));
	//Initialise variables
	timer0=millis();
