Arduino to PC/Mac running ReaBasic 2010r3 Serial

I’m reading a chain of (6) Dallas 18B20’s formatting a 50 byte string like this: D1:76.00D1:76.00D1:76.00D1:76.00D1:76.00D1:76.00 and sending it out with serial.print. No problems on the Arduino side, lines just continuing scroll by in the serial monitor window of the IDE.

What I want to do is capture this string in RealBasic, parse the 6 temperature values out and yada yada yada off I go.

Can’t figure for the life of me how to do it. I can do a

Main.TextArea.AppendText Me.ReadAll() in the DataAvailable section of the Serial Control and sure enough, there are the lines, scrolling by at about 4 per second.

But how do I grab each line so that I can parse out the temperature values in to an 6 element array???

The only thing that indicates a "line" is the carriage return that is printed by Serial.println().

  1. Keep a String and continually add the incoming serial data to it.
  2. Read through the string from the beginning until you find a carriage return.
  3. Copy the substring until the carriage return to a new variable.
  4. Remove the substring from your input string.
  5. Process the individual line (parse using the semicolons)
  6. Loop #1-5

Kind of a pain, but most languages I've worked with don't have a method for reading in a line at a time from the Serial connection. The idea of a line isn't well defined for serial data. All it knows is that ASCII 13 means a carriage retun character. It's all just a big stream of data which happens to have carriage return characters in it.

I suppose if you had access to a tokenizer like Java does, you could parse the incoming serial data a bit more easily.