Page 101 - MDP2020-2
P. 101
················································································ 명장양성프로젝트 【MDP】 과제발표회 자료집 Ⅱ | 95
char ibiOutput[81];
strcpy(ibiOutput, "IBI:");
sprintf(ibiStr, "%d", IBI);
strcat(ibiOutput, ibiStr);
u8g.drawStr(62, 64, ibiOutput);
}
void drawY(){
u8g.drawPixel(0, y[0]);
for(int x=1; x<LENGTH; x++){
if(y[x]!=-1){
u8g.drawLine(x-1, y[x-1], x, y[x]);
}else{
break;
}
}
}
void interruptSetup(){
TCCR2A = 0x02;
TCCR2B = 0x06;
OCR2A = 0X7C;
TIMSK2 = 0x02;
sei();
}
ISR(TIMER2_COMPA_vect){
cli();
Signal = analogRead(analogInPin);
sampleCounter += 2;
int N = sampleCounter - lastBeatTime; avoid noise
if(Signal < thresh && N > (IBI/5)*3){
if (Signal < T){
T = Signal;
}
}
if(Signal > thresh && Signal > P){
P = Signal;
}
if (N > 250){
if ( (Signal > thresh) && (Pulse == false) && (N > (IBI/5)*3) ){
Pulse = true;