sketch may٠٧a
sketch may٠٧a
#include <Wire.h>
#include "MAX30100.h"
unsigned long x;
unsigned long xx;
unsigned long n;
unsigned long nn;
MAX30100 sensor;
if (!sensor.begin()) {
Serial.print("FAILED: ");
delay(10);
Serial.print("Shutting down..");
sensor.shutdown();
Serial.println("done.");
delay(10);
if (temperature < 5) {
Serial.println("WARNING: Temperature probe reported an odd value");
} else {
Serial.println("All test pass.");
}
Serial.println();
Serial.println("Press any key to go into sampling loop mode");
//while (!Serial.available());
Serial.begin(115200);
sensor.resetFifo();
////////////
// uint16_t ir, red;
//
// sensor.update();
//
// while (sensor.getRawValues(&ir, &red)) {
// // Ser ial.print("IR=");
// if(ir>x){if(ir>xx){x=ir;}}}
//n=ir;
// Serial.println(ir);
// delay(2000);
}
void loop()
{time = millis ( ) ;
if(d==7320){d=0;
myGLCD.clrScr();}
myGLCD.setColor(0,255,255);
myGLCD.drawPixel(d/20,xx-400);
d++;
sensor.update();
if (ir<500&&m==0){m=1;
time1=time;
myGLCD.setColor(0, 255, 0);
// myGLCD.setBackColor(0, 0, 255);
//myGLCD.print(xx, CENTER, 200);
}
if (ir>590&&m==1&&ir<600){mm=1;
}
if (ir<500&&mm==1){time2=time;
time3=(time2-time1);
mm=0;
m=0 ;
}
myGLCD.setColor(0, 255, 0);
// myGLCD.setBackColor(0, 0, 255);
myGLCD.print(" ", CENTER, 200);