Advertisement
pleasedontcode

Heart Monitor rev_01

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