萌新提问关于心率传感器数据显示到三位数码管

直接使用pulse sensor传感器的程序和上位机小软件显示心率图和心率的,目前想把心率数据导出显示到三位共阴的小数码管上,但是快崩溃了,数码管只有一位四位的教程,这并不重要,重要的是怎么把心率数据弄到数码管上,好像没有这样的教程啊。。。着能操作吗?哭唧唧的开源课作业。
这是传感器的程序
int pulsePin = 0;

int blinkPin = 13;

int fadePin = 5;

int fadeRate = 0;

volatile int BPM;

volatile int Signal;

volatile int IBI = 600;

volatile boolean Pulse = false;

volatile boolean QS = false;

void setup(){
pinMode(blinkPin,OUTPUT);

pinMode(fadePin,OUTPUT);

Serial.begin(115200);

interruptSetup();

}

void loop(){
sendDataToProcessing('S', Signal);

if (QS == true){

fadeRate = 255;

sendDataToProcessing('B',BPM);

sendDataToProcessing('Q',IBI);

QS = false;

}

ledFadeToBeat();

delay(20);

}

void ledFadeToBeat(){
fadeRate -= 15;

fadeRate = constrain(fadeRate,0,255);

analogWrite(fadePin,fadeRate);

}

void sendDataToProcessing(char symbol, int data ){
Serial.print(symbol);

Serial.println(data);

}

volatile int rate[10];

volatile unsigned long sampleCounter = 0;

volatile unsigned long lastBeatTime = 0;

volatile int P =512;

volatile int T = 512;

volatile int thresh = 512;

volatile int amp = 100;

volatile boolean firstBeat = true;

volatile boolean secondBeat = false;

void interruptSetup(){

TCCR2A = 0x02;

TCCR2B = 0x06;

OCR2A = 0X7C;

TIMSK2 = 0x02;

sei();

}

ISR(TIMER2_COMPA_vect){

cli();

Signal = analogRead(pulsePin);

sampleCounter += 2;

int N = sampleCounter - lastBeatTime;

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;

digitalWrite(blinkPin,HIGH);

IBI = sampleCounter - lastBeatTime;

lastBeatTime = sampleCounter;

if(secondBeat){

secondBeat = false;

for(int i=0; i<=9; i++){

rate[i] = IBI;

}
}

  if(firstBeat){                        
    firstBeat = false;                   
    secondBeat = true;                  
    sei();                               
    return;                              
  }   



  word runningTotal = 0;                 

  for(int i=0; i<=8; i++){               
    rate[i] = rate[i+1];                 
    runningTotal += rate[i];              
  }

  rate[9] = IBI;                        
  runningTotal += rate[9];                
  runningTotal /= 10;                     
  BPM = 60000/runningTotal;               
  QS = true;                             
}                       

}

if (Signal < thresh && Pulse == true){

digitalWrite(blinkPin,LOW);

Pulse = false;

amp = P - T;

thresh = amp/2 + T;

P = thresh;

T = thresh;
}

if (N > 2500){

thresh = 512;

P = 512;

T = 512;

lastBeatTime = sampleCounter;

firstBeat = true;

secondBeat = false;

}

sei();

}

https://wenku.baidu.com/view/167e773759fb770bf78a6529647d27284b733715.html

显示到三位数码管上,主要是接线和数码管显示控制。

1.三位数码管的接线你是否已经掌握?

2.三位数码管的位选和段选代码是否已经掌握?

3.代码中只看到了两个传感器的接口定义,但是没有看到数码管控制接口定义,是否缺失数码管控制的代码?