/********* Pleasedontcode.com **********

	Pleasedontcode thanks you for automatic code generation! Enjoy your code!

	- Terms and Conditions:
	You have a non-exclusive, revocable, worldwide, royalty-free license
	for personal and commercial use. Attribution is optional; modifications
	are allowed, but you're responsible for code maintenance. We're not
	liable for any loss or damage. For full terms,
	please visit pleasedontcode.com/termsandconditions.

	- Project: Heart Monitor
	- Source Code NOT compiled for: ESP32 DevKit V1
	- Source Code created on: 2024-05-06 11:31:59

********* Pleasedontcode.com **********/

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* grap the oximeter and send every 4 mseconds a read */
	/* out o the BLE channel */
/****** END SYSTEM REQUIREMENTS *****/

/****** DEFINITION OF LIBRARIES *****/
#include <Wire.h>
#include <MAX30100_PulseOximeter.h>	//https://github.com/gabriel-milan/Arduino-MAX30100

/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);

/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t max3000_MAX30100_INT_PIN_D4 = 4;

/***** DEFINITION OF I2C PINS *****/
const uint8_t max3000_MAX30100_I2C_PIN_SDA_D21 = 21;
const uint8_t max3000_MAX30100_I2C_PIN_SCL_D22 = 22;

/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
PulseOximeter pox;

void setup(void)
{
	// put your setup code here, to run once:
	pinMode(max3000_MAX30100_INT_PIN_D4, INPUT_PULLUP);

	// Initialize the PulseOximeter
	pox.begin();

	// Set up BLE channel for sending oximeter data every 4 milliseconds
}

void loop(void)
{
	// put your main code here, to run repeatedly:
	
	// Update the sensor readings every 4 milliseconds
	pox.update();
	
	// Retrieve heart rate and SpO2 values
	float heartRate = pox.getHeartRate();
	uint8_t spo2 = pox.getSpO2();

	// Send the data out to the BLE channel

	delay(4); // Delay for 4 milliseconds
}

/* END CODE */