问题
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