Skip to content

Instantly share code, notes, and snippets.

@rrgarciach
Created March 1, 2016 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rrgarciach/972f18fcf5ff0f01b526 to your computer and use it in GitHub Desktop.
Save rrgarciach/972f18fcf5ff0f01b526 to your computer and use it in GitHub Desktop.
SpO2 sensor Arduino sketch
const int SENSOR_PIN = 0;
const int AMOUNT = 20;
int averageLevel = 0;
int averageIndex = 0;
/**
* The Pulse Oximeter sketch is an Arduino sketch intended for use with an
* analog sensor reading the amount of light passing through a human finger.
*
* It could be made more generically into an analog signal averaging sketch.
* There is nothing here that specifically deals with heart rate measurement.
*/
void setup() {
pinMode(0, INPUT);
pinMode(1, INPUT);
Serial.begin(19200);
}
void loop() {
delay(10);
printDots(analogRead(0));
// Serial.println(analogRead(0));
}
void printDots(int value) {
int count = (value / 10) - 30;
while (count > 0) {
Serial.print("X");
--count;
}
Serial.println("");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment