Commit b0d8a124 authored by Gayan Kavinda Gamlath's avatar Gayan Kavinda Gamlath 😂

dust_sensor_mod

parent 4c19fa1c
......@@ -10,11 +10,19 @@ float calcVoltage = 0; /*Calculate Voltage*/
float dustDensity = 0; /*Dust Density Size*/
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); /*initialize the Serial Monitor at a baud rate of 9600 for debugging purposes*/
pinMode(ledPower,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(ledPower,LOW); /*turn on the IR LED*/
delayMicroseconds(samplingTime); /*waiting for 0.28ms before taking a reading of the output voltage value*/
voMeasured = analogRead(measurePin); /*Read the voltage values from the analog pin*/
delayMicroseconds(deltaTime); /*40-microsecond delay before turning the dust sensor led off*/
digitalWrite(ledPower,HIGH); /*LED should be pulsed on once every 10ms. It means LED start to blinking*/
delayMicroseconds(sleepTime); /*Sleep time because 10ms cycle = 10000 - 280 - 40 = 9680 microseconds. It means this delay loop in 1 sec*/
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment