Created
March 1, 2016 19:04
-
-
Save rrgarciach/972f18fcf5ff0f01b526 to your computer and use it in GitHub Desktop.
SpO2 sensor Arduino sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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