Newer
Older
RespDoppler / DopplerSignal / DopplerSignal.ino


const int DOPPLER_0_PIN = A0;
const int DOPPLER_1_PIN = A1;
const int MEAN_SIZE = 10;
int gDoppler0 = 0;  // value read from the doppler 0
int gDoppler1 = 0;  // value read from the doppler 1
int gSum0 = 0;
int gSum1 = 0;

void setup() {
  Serial.begin(115200);
}

void loop() {
  gSum0 = 0;
  gSum1 = 0;
  for (int i = 0; i < MEAN_SIZE; i++){
    gDoppler0 = analogRead(DOPPLER_0_PIN);
    gDoppler1 = analogRead(DOPPLER_1_PIN);
    gSum0 += gDoppler0;
    gSum1 += gDoppler1;
    delay(1);
  }

  // print the results to the Serial Monitor:
  Serial.print((float)gSum0 / MEAN_SIZE);
  Serial.print(",");
  Serial.println((float)gSum1 / MEAN_SIZE);
}