Advertisement
pleasedontcode

MAX30100 Library rev_02

May 6th, 2024
569
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 Library
  13.     - Source Code compiled for: ESP32 DevKit V1
  14.     - Source Code created on: 2024-05-06 11:34:30
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* grap the oximeter and send every 4 mseconds a read */
  21.     /* out o the BLE channel */
  22. /****** END SYSTEM REQUIREMENTS *****/
  23.  
  24.  
  25. /****** DEFINITION OF LIBRARIES *****/
  26. #include <Wire.h>
  27. #include <MAX30100_PulseOximeter.h> //https://github.com/gabriel-milan/Arduino-MAX30100
  28.  
  29. /****** FUNCTION PROTOTYPES *****/
  30. void setup(void);
  31. void loop(void);
  32.  
  33. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  34. const uint8_t max3000_MAX30100_INT_PIN_D4 = 4;
  35.  
  36. /***** DEFINITION OF I2C PINS *****/
  37. const uint8_t max3000_MAX30100_I2C_PIN_SDA_D21 = 21;
  38. const uint8_t max3000_MAX30100_I2C_PIN_SCL_D22 = 22;
  39.  
  40. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  41. PulseOximeter pox;
  42.  
  43. void setup(void)
  44. {
  45.     // put your setup code here, to run once:
  46.     pinMode(max3000_MAX30100_INT_PIN_D4, INPUT_PULLUP);
  47.  
  48.     // Initialize the PulseOximeter
  49.     pox.begin();
  50.  
  51.     // Set up BLE channel for sending oximeter data every 4 milliseconds
  52. }
  53.  
  54. void loop(void)
  55. {
  56.     // put your main code here, to run repeatedly:
  57.    
  58.     // Update the sensor readings every 4 milliseconds
  59.     pox.update();
  60.    
  61.     // Retrieve heart rate and SpO2 values
  62.     float heartRate = pox.getHeartRate();
  63.     uint8_t spo2 = pox.getSpO2();
  64.  
  65.     // Send the data out to the BLE channel
  66.  
  67.     delay(4); // Delay for 4 milliseconds
  68. }
  69.  
  70. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement