Stap 12: Software Code uitleg - vervolg
**********GPS Longitude DATA SEPERATION*********** Serial.println("LON:"+ longitude); String dd, mm1, mm2, mm3; int dotlocation = longitude.indexOf('.'); dd = longitude.substring(dotlocation-5, dotlocation-2); mm1 = longitude.substring(dotlocation-2, dotlocation); mm2 = longitude.substring(dotlocation+1, dotlocation+5); unsigned long D1 = dd.toInt(); //Convert the recived string to int unsigned long MM1 = mm1.toInt(); //Convert the recived string to int unsigned long MM2 = mm2.toInt(); //Convert the recived string to int int setdot; if (D1 > 99) setdot = 3; else if (D1 >9) setdot = 2; else setdot = 1; Serial.print("DD= "); Serial.println(D1); //Store the dd Serial.print("mm1="); Serial.println(MM1); //Store the mm Serial.print("mm2="); Serial.println(MM2); //Store the .mmmm Serial.print("dotlocation = "); Serial.println(dotlocation);**********************Conversion********************* D1= D1 * 100000; Serial.println(D1); MM1 = MM1 * 10000; unsigned long temp; temp = MM1 + MM2; Serial.println(temp); temp = temp / 6; D1 = D1+ temp; Serial.print("D1 = "); Serial.println(D1); String A = (String)D1; dd = A.substring(0,setdot); mm1= A.substring(setdot);
Hetzelfde proces wordt herhaald voor de lengtegraad.