简体   繁体   中英

Arduino: Printing values calculated in a library onto the serial monitor

I am attempting to get the values from my cooking hacks SPO2 sensor to appear on the Arduino serial monitor, I am using IDE 1.0.6 and the eHealth library V2.4 (July 2015). The sensor is fully operational and values correctly appear on the sensors LED screen but I am struggling to get the values onto the monitor. Any help appreciated, original code can be found on the cooking hacks website as well as the libraries downloaded, eHealth and PinChangeIt (link below).

Cooking hacks eHealth shield

Thanks in advance

#include <eHealth.h>
#include <eHealthDisplay.h>


int cont = 0;
void readPulsioximeter();
void MonitorPrint();



void setup() {

    Serial.begin(9600); 
    Serial.println(eHealth.getOxygenSaturation); 

eHealth.initPulsioximeter();
//Attach the inttruptions for using the pulsioximeter.
attachInterrupt(6, readPulsioximeter, RISING);
}

void loop() {



printf("PRbpm : %d",eHealth.getBPM());`
printf("    %%SPo2 : %d\n", eHealth.getOxygenSaturation());
  printf("=============================");

 digitalWrite(2,HIGH);



 delay(500);



void readPulsioximeter(){



cont ++;



if (cont == 500) { //Get only of one 50 measures to reduce the latency
eHealth.readPulsioximeter();
cont = 0;
   }
}

You can use serial print like this -

  Serial.print("PRbpm : %d \t");
  Serial.print(eHealth.getBPM());
  Serial.print(" %%SPo2 : %d\n \t");
  Serial.print(eHealth.getOxygenSaturation());
  Serial.print("=============================");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM