/********* 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: "Pulse Oximeter Integration" - Source Code compiled for: ESP32 DevKit V1 - Source Code created on: 2024-02-29 13:08:17 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* i want to connect esp32 with max30102 and generate */ /* code and see resualt */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include #include "MAX30100_PulseOximeter.h" /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t MAX30100_INT_PIN = 4; /***** DEFINITION OF I2C PINS *****/ const uint8_t MAX30100_SDA_PIN = 21; const uint8_t MAX30100_SCL_PIN = 22; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ PulseOximeter pox; void setup(void) { // put your setup code here, to run once: pinMode(MAX30100_INT_PIN, INPUT_PULLUP); // Initialize the PulseOximeter library if (!pox.begin()) { Serial.println("Failed to initialize PulseOximeter!"); while (1); } } void loop(void) { // put your main code here, to run repeatedly: // Update the PulseOximeter sensor readings pox.update(); // Get heart rate and SpO2 values float heartRate = pox.getHeartRate(); uint8_t spo2 = pox.getSpO2(); // Print the values to the serial monitor Serial.print("Heart Rate: "); Serial.print(heartRate); Serial.print(" bpm, SpO2: "); Serial.print(spo2); Serial.println("%"); // Delay for some time before the next reading delay(1000); }