Hello,
I am fairly new to Arduino. I have recently started working on a basic RC boat design by following tutorials. I am using a VectorNav VN-200 GNSS system for this project. The issue I am currently facing is that the latitude, longitude and altitude are of the double type and I am having issues printing these using my Arduino Mega (I am aware of the issues with double using the Mega). So far, I have written a function that takes the bytes and converts them to double. I then extract the latitude, longitude and altitude from the message but have had no luck getting these to print. I either see 0 or ovf. The following is what I have:
// Convert byte array to double
double bytesToDouble(const unsigned char* bytes) {
double value;
memcpy(&value, bytes, sizeof(double));
return value;
//
Extract poslat, poslon, and posalt (double) from bytes 45-68
double poslat = bytesToDouble(&message[44]); // bytes 45-52
double poslon = bytesToDouble(&message[52]); // bytes 53-60
double posalt = bytesToDouble(&message[60]); // bytes 61-68
Serial.print(poslat, 6);
Can someone please help me with this or point me in the right direction? Thank you!