Skip to content

Instantly share code, notes, and snippets.

@monpetit
Created June 7, 2016 05:42
Show Gist options
  • Select an option

  • Save monpetit/3d7f4d02535b1d9d87dfb4bb484f6b84 to your computer and use it in GitHub Desktop.

Select an option

Save monpetit/3d7f4d02535b1d9d87dfb4bb484f6b84 to your computer and use it in GitHub Desktop.
const int measurePin = A0;
const int ledPower = 3;
const int samplingTime = 280;
const int deltaTime = 40;
const int sleepTime = 9680;
float voMeasured = 0;
void adc10_measure_dust_density(void)
{
digitalWrite(ledPower, LOW); // LED 켜기
delayMicroseconds(samplingTime); // 0.28 밀리초 대기
voMeasured = analogRead(measurePin); // 센서값 측정
delayMicroseconds(deltaTime); // 0.04 밀리초 대기
digitalWrite(ledPower, HIGH); // LED 끄기
delayMicroseconds(sleepTime); // 9.68 밀리초 대기
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment