/********* 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 Rate**
- Source Code NOT compiled for: Arduino Nano
- Source Code created on: 2025-02-17 16:42:41
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* The system shall utilize the MAX30102 sensor to */
/* monitor heart rate and SpO2 levels, displaying */
/* data via I2C communication. */
/****** SYSTEM REQUIREMENT 2 *****/
/* The system shall utilize the MAX30102 sensor to */
/* accurately monitor heart rate and SpO2 levels, */
/* transmitting data via I2C communication for real- */
/* time visualization. */
/****** END SYSTEM REQUIREMENTS *****/
/* START CODE */
/****** DEFINITION OF LIBRARIES *****/
#include
#include //https://github.com/Protocentral/protocentral-pulse-express
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF I2C PINS *****/
const uint8_t srt_PIN_SDA_A4 = A4;
const uint8_t srt_PIN_SCL_A5 = A5;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
max32664 pulseSensor(srt_PIN_SDA_A4, srt_PIN_SCL_A5, RAWDATA_BUFFLEN); // Instantiate the MAX30102 sensor
void setup(void)
{
// Initialize I2C communication
Wire.begin();
// Initialize the MAX30102 sensor
if (pulseSensor.hubBegin() != CMD_SUCCESS) {
// Handle initialization error
while (1);
}
// Additional setup code can be added here
}
void loop(void)
{
// Read heart rate and SpO2 data
if (pulseSensor.readSamples() == CMD_SUCCESS) {
// Process and visualize the data
// For example, you can print the values to the Serial Monitor
Serial.print("Heart Rate: ");
Serial.println(pulseSensor.max32664Output.hr);
Serial.print("SpO2: ");
Serial.println(pulseSensor.max32664Output.spo2);
}
// Add a delay for readability
delay(1000);
}
/* END CODE */