 int voMeasured = 0;
 float calcVoltage = 0;
 float dustDensity = 0;
+
+// -----------------------------------------
+long startMills;
 
 // ------------------------------------------
 // IR


void loop()
{
  digitalWrite(ledPower, LOW); // power on the LED
  delayMicroseconds(samplingTime);
  
  voMeasured = analogRead(measurePin); // read the dust value
  
  delayMicroseconds(deltaTime);
  digitalWrite(ledPower, HIGH); // turn the LED off
  delayMicroseconds(sleepTime);

// ------------------------------------------
/* test
  ac_activate(25, 1);
  delay(5000);
  ac_activate(27, 0);
  delay(5000);
*/
  
  if ( r != o_r) {

    /*

 Standalone Sketch to use with a Arduino UNO and a
 Sharp Optical Dust Sensor GP2Y1010AU0F
*/

// ------------------------------------------
int measurePin = A6; //Connect dust sensor to Arduino A6 pin
int ledPower = 2;   //Connect 3 led driver pins of dust sensor to Arduino D2

int IR_receive_recv_PIN = 6;
int IR_receive_GND_PIN  = 7;
int IR_receive_VCC_PIN  = 8;


// A6  : DUST IN
// D2  : DUST OUT
//
// D3  : IR OUT
//
// D6  : IR IN
// D7  : OUT GND
// D8  : OUT VCC
//
// D12 : OUT GND

IRrecv irrecv(IR_receive_recv_PIN); // Receive on pin 6

// ------------------------------------------
int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
