Hello,
I am currently trying to hook up this OpenJumper Compass up to my Arduino Due:
http://store.cutedigi.com/compass-break … l-chipset/
I have tried connecting it to the Serial 1, 2, and 3 ports on the Due using this very simple code:
void setup()
{
Serial.begin(9600);
Serial3.begin(9600);
}
void loop() {
if (Serial3.available()) {
int inByte = Serial3.read();
// Serial.write(inByte);
Serial.println(inByte);
Serial3.flush();
}
else
{Serial.println(“-1”);}
delay(200);
}
When I connect the compass TX to TX3 I get nothing (Due prints “-1”).
When I connect the compass TX to RX3 the Due prints ACSII characters:
13
10
50
57
53
13
10
50
57
51
13
10
50
57
50
13
I have used this code with and without the flush command and the same thing occurs. I have also tried different baud rates with no success.
I know the serial ports work because I have successfully used them to read from a gps unit on my Due. Thus, I figure the problem must be with my connection of the compass to the board.
I would have thought that the compass was broken or damaged, but I have gotten it to print correct values with one particular set up… If I connect the compass TX to the TX0 port on the Due (and the Rx to the RX0), accurate positions print in real time. However, because of the importance of this serial port to other functions of the board, I obviously do not with to use it.
I am baffled by this situation, and if anyone can help me to understand what may be going wrong with my compass or my serial ports I would appreciate it very very much.
Thanks in advance for your help!