Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Serial Communications - SUCCESS!!!

From: greggirwin:mindspring at: 26-Feb-2002 17:48

<< TO DO: My next hurdle is to create a loop to identify the specific NMEA sentences. That funny stuff that looks like [$GPGLL] is what defines a particular data sentence in NMEA. Once I can identify a sentence by the first few characters (in this case a $ sign followed by five letters I can shunt them off for processing. Any pointers in this regard will not be spurned given my recent experience. The first pitfall I see is having Rebol mistake this $ sign for a money token and wrap me up in some data type dungeon. >> Well, we can do some simple things to start with. First, you can split the data string up into fields, assuming that's helpful:
>> b: parse/all {$GPGLL,4330.038,N,08030.681,W,220800,A*3B} ","
== ["$GPGLL" "4330.038" "N" "08030.681" "W" "220800" "A*3B"] Next, you could see if the first field starts with "$", and chop the "$" off of it:
>> if b/1/1 = #"$" [b/1: next b/1]
== ["GPGLL" "4330.038" "N" "08030.681" "W" "220800" "A*3B"] Now, you can look at the first field (i.e. b/1) to see what your code is so you can branch and process accordingly. HTH! --Gregg