#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#define i2c_Address 0x3c //initialize with the I2C addr 0x3C Typically eBay OLED's
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // QT-PY / XIAO
Adafruit_SH1106G display = Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
int IR_val[100] = [
15501, 13111, 25110, 28375, 29604, 30563, 31186, 31392, 31832, 31900,
32064, 32233, 32475, 32242, 32303, 32616, 32628, 32648, 32653, 32764,
32399, 32472, 32550, 32594, 32670, 32706, 32552, 32225, 32357, 32435,
32530, 32642, 32683, 32344, 32206, 32371, 32371, 32495, 32541, 32676,
32223, 32144, 32244, 32231, 32348, 32385, 32420, 32065, 31886, 32008,
32021, 32062, 32167, 32157, 32159, 31694, 31800, 31771, 31874, 31960,
31976, 32029, 31489, 31584, 31629, 31698, 31788, 31864, 31902, 31463,
31502, 31592, 31608, 31730, 31755, 31819, 31328, 31302, 31383, 31387, 31509, 31534, 31611, 31180, 31182, 31244, 31293, 31325, 31434, 31491, 31128, 31113, 31209, 31200, 31314, 31345, 31414, 30969, 30942, 31053
];
void setup() {
Serial.begin(9600);
delay(1000); // wait for the OLED to power up
display.begin(i2c_Address, true); // Address 0x3C default
display.display();
delay(2000);
display.clearDisplay();
display.setTextColor(SH110X_WHITE);
display.setTextSize(2); display.setCursor(10, 0); display.println("HU");
display.setTextSize(1); display.setCursor(40, 4); display.println("PULSE Analyzer");
display.setCursor(10, 20); display.println("IR value: ");
display.display(); delay(2000);
// Initialize sensor
if (particleSensor.begin() == false)
{
Serial.println("MAX30105 was not found. Please check wiring/power. ");
while (1);
}
particleSensor.setup(); //Configure sensor. Use 6.4mA for LED drive
}
void loop() {
IR_val = particleSensor.getIR();
Serial.print(IR_val); Serial.print(", ");
delay(100);
// display.setCursor(70, 20);
// display.println(IR_val);
// display.display();
// delay(1000);
// display.setTextColor(SH110X_BLACK);
// display.setCursor(70, 20);
// display.println(IR_val);
// delay(100);
}