Fair Enough. Let me ask it like this:
How would you print debugging statements from the arduino without them getting in the way of your data?
I think I was mistaken. When Rowberg outputs data, he starts if off with a '$' character. The method below seems to handle this data by checking for the '$' character, but I have no idea how he handles regular string print statements.
void serialEvent(Serial port) {
interval = millis();
while (port.available() > 0) {
int ch = port.read();
// DA - Added this next if statement because we seem to be getting
// off byte boundary with initialization warnings
if(!gotFirstDataByte) {
if (ch == '
what's confusing me is where he actually prints in processing; he mentions initialization warnings, but after reading them in he never calls Println. He does, however, call print from the Arduino several times without using the '$' character, and I don't know how that gets through to the serial monitor.
This post was probably more confusing than the last...if it doesn't make sense don't worry about it. The bottom line is that I'm going to implement my own method by checking for the '$' character and doing what I need to, but if anyone wants to offer some insight it would be welcome.) {
gotFirstDataByte = true;
} else {
return;
}
}
//print((char)ch);
if (aligned < 4) {
// make sure we are properly aligned on a 14-byte packet
if (serialCount == 0) {
if (ch == '
what's confusing me is where he actually prints in processing; he mentions initialization warnings, but after reading them in he never calls Println. He does, however, call print from the Arduino several times without using the '$' character, and I don't know how that gets through to the serial monitor.
This post was probably more confusing than the last...if it doesn't make sense don't worry about it. The bottom line is that I'm going to implement my own method by checking for the '$' character and doing what I need to, but if anyone wants to offer some insight it would be welcome.) aligned++; else aligned = 0;
} else if (serialCount == 1) {
if (ch == 2) aligned++; else aligned = 0;
} else if (serialCount == 12) {
if (ch == '\r') aligned++; else aligned = 0;
} else if (serialCount == 13) {
if (ch == '\n') aligned++; else aligned = 0;
}
//println(ch + " " + aligned + " " + serialCount);
serialCount++;
if (serialCount == 14) serialCount = 0;
} else {
if (serialCount > 0 || ch == '
what's confusing me is where he actually prints in processing; he mentions initialization warnings, but after reading them in he never calls Println. He does, however, call print from the Arduino several times without using the '$' character, and I don't know how that gets through to the serial monitor.
This post was probably more confusing than the last...if it doesn't make sense don't worry about it. The bottom line is that I'm going to implement my own method by checking for the '$' character and doing what I need to, but if anyone wants to offer some insight it would be welcome.) {
teapotPacket[serialCount++] = (char)ch;
if (serialCount == 14) {
serialCount = 0; // restart packet byte position
// get quaternion from data packet
q[0] = ((teapotPacket[2] << 8) | teapotPacket[3]) / 16384.0f;
q[1] = ((teapotPacket[4] << 8) | teapotPacket[5]) / 16384.0f;
q[2] = ((teapotPacket[6] << 8) | teapotPacket[7]) / 16384.0f;
q[3] = ((teapotPacket[8] << 8) | teapotPacket[9]) / 16384.0f;
for (int i = 0; i < 4; i++) if (q[i] >= 2) q[i] = -4 + q[i];
// set our toxilibs quaternion to new data
quat.set(q[0], q[1], q[2], q[3]);
}
}
}
}
}
what's confusing me is where he actually prints in processing; he mentions initialization warnings, but after reading them in he never calls Println. He does, however, call print from the Arduino several times without using the '$' character, and I don't know how that gets through to the serial monitor.
This post was probably more confusing than the last...if it doesn't make sense don't worry about it. The bottom line is that I'm going to implement my own method by checking for the '$' character and doing what I need to, but if anyone wants to offer some insight it would be welcome.