How do I display data with values updated in a textview?

我们两清 提交于 2020-01-07 03:10:30

问题


I would like to display my data as shown in the image below:

Now my data is display in listview as shown. But the problem is I don't know what data I receiving. In other words, I won't know when I will receive temperature data and when I will receive RBPM and SPO2.

#include <PinChangeInt.h>
#include <PinChangeIntConfig.h>

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


int cont = 0;

void setup() {
  Serial.begin(9600);  
  eHealth.initPulsioximeter();

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

void loop() {
//getting the value as a variable
int BPMval= eHealth.getBPM();
int SPO2val = eHealth.getOxygenSaturation();
float temperature = eHealth.getTemperature();

 Serial.println(BPMval);
 Serial.println(SPO2val);
 Serial.println(temperature, 2); 
 delay(250);
}


//Include always this code when using the pulsioximeter sensor
//=========================================================================
void readPulsioximeter(){  

  cont ++;

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

Hi I includeded the Arduino code here for more details. should I print something like println("#"); so I can identify the data I receiving??


回答1:


There is nothing we can do to help you with this. You have to be able to recognize the input type.

You could try to use regular expression pattern matching to 'maybe' (depending on the consistency of the two(or more) input possibilities.

http://developer.android.com/reference/java/util/regex/Pattern.html



来源:https://stackoverflow.com/questions/34407661/how-do-i-display-data-with-values-updated-in-a-textview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!