WiFi Radio Project - LCD display help!

Hello all!

Let me first start off by saying I'm a newb, but I'm trying to gain a little momentum with a WiFi radio project. I'm basing my build off of Jeff's design (mightyohm.com/blog/2008/10/building-a-wifi-radio-part-1-introduction/), but I decided to go with a boarduino instead of his AVR.

I've got the boarduino up and running a simple program which displays title and track information sent from my router through a serial connection on to a 2x16 LCD using the 4bit lcd driver. However, I can't for the life of me determine how to -

a)Parse the serial data (the data is sent 2 lines at a time)

and b) split the 2 bits of info onto separate lines.

Any and all help would be appreciated.

Well I think Jeff has the code on his blog ?

Anyhow, if the data is sent in one go as 32 characters (=bytes), just read it into an array. Then you know the first line ends at index 15! Or maybe he sends "\n" or "\r" to end a line.

I’ve tried his code, but it doesn’t seem to work the way it should - it never sends a carriage return. Here’s what I have -

#include <LCD4Bit.h>

LCD4Bit lcd = LCD4Bit(2);   // set the number of Displays lines

char data1[40];
char data2[40];

void setup() {
  Serial.begin(9600);         // set the baudrate
  lcd.init();                 // initialize
  lcd.clear();                // clear the screen
  lcd.printIn("Waiting");   // display something

void loop()
  int i=0;
  int o=0;
  if (Serial.available()) {        //something's coming
    delay(900);                    //wait for it
    lcd.clear();                   //clear the old junk
    while (Serial.available()) {   
      data1[i] = Serial.read();    //import a letter at a time
      if (data1[i] == 13){          //encounters a carriage return
       while (Serial.available()) { 
        data2[o] = Serial.read();  //save line 2 data
        o++;                       //get the next letter
    i++;                           //get the next letter
  int t;
  int b;
  lcd.printIn(data1);        //Print data1 on line 1
  lcd.printIn(data2);        //Print data2 on line 2
  if (i > o){                     //determine the max scroll length

and it definitely receives info, but the LCD output is gibberish characters. I can strip the code down to display LCD messages manually, so I know wiring/baudrate is right. The text it gets through the serial port is also formatted correctly. :-[

okay, so I got it to display actual characters, but it still doesn't save a string in the line2 variable after catching a carriage return.