Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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: MAX30100 Monitor
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2024-05-06 13:46:24
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* C: AND BPM: AND SPO2: */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Wire.h>
- #include <MAX30100_PulseOximeter.h> // Include the MAX30100 library
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t LCD_MAX30100_INT_PIN_D2 = 2;
- /***** DEFINITION OF I2C PINS *****/
- const uint8_t LCD_MAX30100_I2C_PIN_SDA_A4 = A4;
- const uint8_t LCD_MAX30100_I2C_PIN_SCL_A5 = A5;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- MAX30100_PulseOximeter pox; // Instantiate the PulseOximeter object from the MAX30100 library
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(LCD_MAX30100_INT_PIN_D2, INPUT_PULLUP);
- // Initialize the PulseOximeter object
- if (!pox.begin()) {
- Serial.println("MAX30100 was not found. Please check wiring/power.");
- while (1);
- }
- // Setup the MAX30100 with a sample rate of 50 Hz
- pox.setSampleRate(50);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- pox.update(); // Update the sensor readings
- // Retrieve heart rate and SpO2 values
- if (pox.available()) {
- Serial.print("Heart rate: ");
- Serial.print(pox.getHeartRate());
- Serial.print(" bpm / SpO2: ");
- Serial.print(pox.getSpO2());
- Serial.println("%");
- }
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement