Final Hcode
Final Hcode
h"
#include <U8g2lib.h>
#include <Wire.h>
PulseOximeter pox;
unsigned long lastDebounceTime = 0; // the last time the output pin was toggled
unsigned long debounceDelay = 50; // the debounce time; increase if the output flickers
}
u8g2.sendBuffer(); //send to arduino
}
void display_values() //declare function to display value
{
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_smart_patrol_nbp_tf); //set font
u8g2.setCursor(30,12); //location
u8g2.print(average_beat); //call average-beat
u8g2.print(" Bpm");
if(average_beat > lowersetpoint && average_beat < uppersetpoint){ //condition to set the min & max values for
age bracket
u8g2.setFont(u8g2_font_smart_patrol_nbp_tf);
u8g2.setCursor(30,30); //location
u8g2.print("NORMAL");
u8g2.sendBuffer(); //send to arduino
}
if(average_beat > uppersetpoint || average_beat < lowersetpoint){ //condition to set the min&max values for age
bracket
u8g2.setFont(u8g2_font_smart_patrol_nbp_tf);
u8g2.setCursor(25,30); //location
u8g2.print("ABNORMAL");
u8g2.sendBuffer(); //send to Arduino
}
u8g2.setFont(u8g2_font_smart_patrol_nbp_tf);
u8g2.setCursor(75,30);
u8g2.print("NO");
}
if (reading != lastButtonState) {
// reset the debouncing timer
lastDebounceTime = millis();
}
void setup()
{
Serial.begin(115200);
u8g2.begin(); //initialized the OLED library
pox.begin(); //initialized the sensor Max30100 library
initial_display();
void loop()
{
// Make sure to call update as fast as possible
pox.update();
menu();
}