Advertisement
pleasedontcode

MAX30100 Monitor rev_01

May 6th, 2024
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: MAX30100 Monitor
  13.     - Source Code NOT compiled for: Arduino Uno
  14.     - Source Code created on: 2024-05-06 13:46:24
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* C:    AND BPM:    AND    SPO2: */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24. #include <Wire.h>
  25. #include <MAX30100_PulseOximeter.h>    // Include the MAX30100 library
  26.  
  27. /****** FUNCTION PROTOTYPES *****/
  28. void setup(void);
  29. void loop(void);
  30.  
  31. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  32. const uint8_t LCD_MAX30100_INT_PIN_D2 = 2;
  33.  
  34. /***** DEFINITION OF I2C PINS *****/
  35. const uint8_t LCD_MAX30100_I2C_PIN_SDA_A4 = A4;
  36. const uint8_t LCD_MAX30100_I2C_PIN_SCL_A5 = A5;
  37.  
  38. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  39. MAX30100_PulseOximeter pox; // Instantiate the PulseOximeter object from the MAX30100 library
  40.  
  41. void setup(void)
  42. {
  43.     // put your setup code here, to run once:
  44.     pinMode(LCD_MAX30100_INT_PIN_D2, INPUT_PULLUP);
  45.  
  46.     // Initialize the PulseOximeter object
  47.     if (!pox.begin()) {
  48.         Serial.println("MAX30100 was not found. Please check wiring/power.");
  49.         while (1);
  50.     }
  51.  
  52.     // Setup the MAX30100 with a sample rate of 50 Hz
  53.     pox.setSampleRate(50);
  54. }
  55.  
  56. void loop(void)
  57. {
  58.     // put your main code here, to run repeatedly:
  59.     pox.update(); // Update the sensor readings
  60.  
  61.     // Retrieve heart rate and SpO2 values
  62.     if (pox.available()) {
  63.         Serial.print("Heart rate: ");
  64.         Serial.print(pox.getHeartRate());
  65.         Serial.print(" bpm / SpO2: ");
  66.         Serial.print(pox.getSpO2());
  67.         Serial.println("%");
  68.     }
  69. }
  70.  
  71. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement