Separate and filter Serial data

Hi all!

Not my first time in this forum seeking for help. So far I am moving on. With your help just one problem remained:

I receive serial data via zigbee on a Arduino Fio on a 16,2 LCD. The Data comes in following format:

0001 0.102 uSvievert/h

First row are the seconds moving up to 9999 and restart at 0000. Then one or two spaces. Then the measurement separated by one space to the unit.

I would like to separate the data that I can set the unit into the second line of the LCD and convert the first row to hours, minutes, seconds.

The code for printing the data:

void loop()
{    
    if (Serial.available()) {
      delay(50);
      lcd.clear();
      while (Serial.available() > 0) {
        SSMData = Serial.read();
        lcd.write(SSMData);
      }
    }
 }

Anyone any Idea? Please help!

int Timestamp;
double Value;
char unit[20];
void setup(){
    Serial.begin(115200);
}//setup()

void loop() {    
   if (Serial.available()) {
     delay(50);
     //lcd.clear();
     while (Serial.available() > 0) {
       Timestamp = Serial.parseInt();
       Value = Serial.parseFloat();
       Serial.readBytesUntil('\10', unit, 19);
       //lcd.write(SSMData);
       Serial.println(Timestamp);
       Serial.println(Value);
       Serial.println(unit);
     }//while(Serial.available())
   }//if(Serial.available())
}//loop()

Hi and thanks. Will try it tomorrow.

Hello,

sorry to tell you but it didn´t work. I get a lot of symbols back which I can´t read. Sometimes the Timestamp is readable. But thanks anyway.

I did test it with the data you specified

Could it be that the i2c lcd I am using causes the problem?

i do not have a lcd s i was not able to test it. A good priciple in programming is what i call incremental testing. basically that is doing one thing at a time and making sure everything works before you take the next step. That will take a lot of the guesswork away. Can you run my code as it is through the serial monitor?