MAX BPM OLED Buzzer - Ino
MAX BPM OLED Buzzer - Ino
MAX BPM OLED Buzzer - Ino
* It's displays the Average BPM on the screen, with an animation and a buzzer
sound
* everytime a heart pulse is detected
* It's a modified version of the HeartRate library example
* Refer to www.surtrtech.com for more details or SurtrTech YouTube channel
*/
MAX30105 particleSensor;
void loop() {
long irValue = particleSensor.getIR(); //Reading the IR value it will permit us
to know if there's a finger on the sensor or not
//Also detecting a heartbeat
if(irValue > 7000){ //If a finger is
detected
display.clearDisplay(); //Clear the display
display.drawBitmap(5, 5, logo2_bmp, 24, 21, WHITE); //Draw the first bmp
picture (little heart)
display.setTextSize(2); //Near it display
the average BPM you can display the BPM if you want
display.setTextColor(WHITE);
display.setCursor(50,0);
display.println("BPM");
display.setCursor(50,18);
display.println(beatAvg);
display.display();
}
if (irValue < 7000){ //If no finger is detected it inform the user and put
the average BPM to 0 or it will be stored for the next measure
beatAvg=0;
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(30,5);
display.println("Please Place ");
display.setCursor(30,15);
display.println("your finger ");
display.display();
noTone(3);
}