Hi Paul,
as mentioned before, I've copy/pasted the code from
a) http://kingtidesailing.blogspot.de/2015/09/how-to-make-nmea-0183-tilt-compensated.html (see IMU_Source; too long for inline display)
its is based on the
https://github.com/richards-tech/RTIMULib
RTIMULib.
From the forum here I've modified the "readserial" code and added it after a).
b) Serial Input Basics - updated - Introductory Tutorials - Arduino Forum
// read serial1 (GPS)
// code from https://forum.arduino.cc/index.php?topic=396450.0
recvWithStartEndMarkers();
showNewData();
}
// Functions
void recvWithStartEndMarkers() {
static boolean recvInProgress = false;
static byte ndx = 0;
char startMarker = '
Due to my limited programming skills, I cannot comment about code a).
b) is somewhat comprehensible to me.
What I can say is that a) is running flawlessly without b) and vice versa.
So with just one device (GPS or IMU) connected, everything works fine. As soon as I try to read from both devices, the problems do start.
Regarding your first question:
while (imu->IMURead()) {
I did not receive any error message.
Any further thoughts?
regards Matthias
IMU_Source.txt (7.49 KB);
//char endMarker = '>';
char endMarker = '\n';
char rc;
while (Serial1.available() > 0 && newData == false) {
rc = Serial1.read();
if (recvInProgress == true) {
if (rc != endMarker) {
receivedChars[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;
}
}
else {
receivedChars[ndx] = '\0'; // terminate the string
recvInProgress = false;
ndx = 0;
newData = true;
}
}
else if (rc == startMarker) {
recvInProgress = true;
}
}
}
void showNewData() {
if (newData == true) {
Serial.print("$");
Serial.println(receivedChars);
newData = false;
}
}
Due to my limited programming skills, I cannot comment about code a).
b) is somewhat comprehensible to me.
What I can say is that a) is running flawlessly without b) and vice versa.
So with just one device (GPS or IMU) connected, everything works fine. As soon as I try to read from both devices, the problems do start.
Regarding your first question:
§DISCOURSE_HOISTED_CODE_1§
I did not receive any error message.
Any further thoughts?
regards Matthias
[IMU_Source.txt|attachment](upload://s8dcQSpxPLmAJkMTkUGcWrRvHGD.txt) (7.49 KB)