C++ Arduino:将库中计算的值打印到串行监视器上
我正在尝试从我的cooking hacks SPO2传感器获取显示在Arduino串行监视器上的值,我正在使用IDE 1.0.6和eHealth library V2.4(2015年7月)。传感器完全工作,数值正确显示在传感器LED屏幕上,但我正在努力将数值显示在监视器上。感谢您的帮助,原始代码可以在cooking hacks网站以及下载的库、eHealth和PinChangeIt(以下链接)上找到 提前谢谢C++ Arduino:将库中计算的值打印到串行监视器上,c++,arduino,C++,Arduino,我正在尝试从我的cooking hacks SPO2传感器获取显示在Arduino串行监视器上的值,我正在使用IDE 1.0.6和eHealth library V2.4(2015年7月)。传感器完全工作,数值正确显示在传感器LED屏幕上,但我正在努力将数值显示在监视器上。感谢您的帮助,原始代码可以在cooking hacks网站以及下载的库、eHealth和PinChangeIt(以下链接)上找到 提前谢谢 #include <eHealth.h> #include <eH
#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;
}
}
#包括
#包括
int cont=0;
无效读数脉冲最大计();
void MonitorPrint();
无效设置(){
Serial.begin(9600);
序列号.println(eHealth.getOxygenSaturation);
eHealth.initPulsioximeter();
//连接用于使用脉动计的输入。
连接中断(6,读取脉冲最大值,上升);
}
void循环(){
printf(“PRbpm:%d”,eHealth.getBPM())`
printf(“%%SPo2:%d\n”,eHealth.getOxygenSaturation());
printf(“=======================================================”);
数字写入(2,高);
延迟(500);
空隙率读数脉冲最大计(){
cont++;
如果(cont==500){//只获取50个措施中的一个来减少延迟
eHealth.readPulsioximeter();
cont=0;
}
}
您可以像这样使用串行打印-
Serial.print("PRbpm : %d \t");
Serial.print(eHealth.getBPM());
Serial.print(" %%SPo2 : %d\n \t");
Serial.print(eHealth.getOxygenSaturation());
Serial.print("=============================");
你可以像这样使用串行打印-
Serial.print("PRbpm : %d \t");
Serial.print(eHealth.getBPM());
Serial.print(" %%SPo2 : %d\n \t");
Serial.print(eHealth.getOxygenSaturation());
Serial.print("=============================");
您好,您是否建议创建一个新函数或将此代码放在我的草图中已有的函数中。我已经添加了代码,现在正在获取信息打印到串行监视器上,谢谢您,但是数据不是。我是否应该为数据创建变量,例如:“float eHealth.getBPM”然后使用Serial.print代替eHealth.getBPM()打印此文件是的,那太好了。创建变量并在循环中每次更新和打印它。如果它对您有帮助,请更新我的答案。!您好,您建议创建一个新函数或将此代码放置在我的草图中已经存在的函数之一中。我已经添加了代码,我现在正在获取信息打印到串行监视器上,谢谢,但是数据不是。我是否应该为数据创建变量,例如:“float eHealth.getBPM”,然后是Serial。打印此变量而不是eHealth.getBPM()。是的,那太好了。创建变量并在循环中每次更新和打印它。如果有帮助,请更新我的答案。!