This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Allow NMEA 0183 file input/output
#4
(2017-05-30, 10:48 PM)abarrow Wrote: I don't suppose you could share your Arduino code? At least I wouldn't have to start from scratch!

Here are the 2 arduino functions which did the work..


Quote:String parseNmea(String nmeaBad)
{
  //Serial.print(nmeaBad);
  nmeaGood=nmeaBad.substring(1, nmeaBad.indexOf("*"));     //cut of the leading "$" and the bad checksum

int  CheckSum=(checkSum(nmeaGood));                //create a good checksum
  nmeaGood="$"+nmeaGood+ "*" +  String(CheckSum, HEX) + "\r\n";     // make the good nmea string

//  Serial.println(nmeaGood); 
return nmeaGood;
}


//---create a nmea checksum
char checkSum(String theseChars) {
  char check = 0;
  // iterate over the string, XOR each byte with the total sum:
  for (int c = 0; c < theseChars.length(); c++) {
    check = char(check ^ theseChars.charAt©);
  } 
  // return the result
  return check;
I was actually just having a look at node-red function but couldn't get it to work, javascript makes my head hurt :Smile
Still failing at sending an nmea sentence to kplex from node red as well. Oh well. :Smile
Reply


Messages In This Thread
Allow NMEA 0183 file input/output - by abarrow - 2017-05-30, 10:12 PM
RE: Allow NMEA 0183 file input/output - by PaddyB - 2017-05-30, 10:18 PM
RE: Allow NMEA 0183 file input/output - by PaddyB - 2017-05-30, 11:59 PM
RE: Allow NMEA 0183 file input/output - by PaddyB - 2017-05-31, 10:32 AM
RE: Allow NMEA 0183 file input/output - by PaddyB - 2017-05-31, 11:59 AM
RE: Allow NMEA 0183 file input/output - by MatsA - 2017-08-13, 09:11 PM
RE: Allow NMEA 0183 file input/output - by PaddyB - 2017-08-14, 12:46 PM
RE: Allow NMEA 0183 file input/output - by MatsA - 2017-08-15, 09:14 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)