I am having an issue where the zumo robot hangs in compass.read(). I am using the calibrate example and it won’t print anything after compass.read(); I am using the leonardo any advice?
I am sorry you are having trouble reading the compass on the Zumo. It should work with the Leonardo as long as the I2C connections are made correctly. Can you post pictures of your setup that show how everything is connected?
Yes, the SCL and SDA connections are already set on the Zumo and connected to the compass. So, if the Leonardo and its headers are mounted correctly, you should be able to interface with the compass. I could have been more clear in my last post; I am sorry about that!
I was able to successfully run your code on a Leonardo with a Zumo; do you have access to another Arduino that works with the Zumo (e.g. Uno, Leonardo, etc.)? If not, could you post pictures of how you have your Leonardo connected? Also, have you cut the SCL and SDA jumpers in the middle of the board? (Cutting them will disconnect the compass from those lines.)
I’m seeing the same problem with the calibrate example where I can log to serial up until my first compass.read() using the calibrate example. I’m using an Uno R1, example of hookups below, and no I have not cut the trace between SDA and SCL.
The SCL and SDA pins do not exist on Arduino hardware versions prior to the Uno R3, so you will have to manually connect SCL to analog pin 5 and SDA to analog pin 4 on the Zumo Shield in order to use the compass. The most convenient place to do this is in the front expansion area, where these pins are all located together, as indicated by the light blue boxes in the picture below:
I just tried to use the compass on my Zumo and I also experiencing the sketch hang up at the first compass.read() call.
I am using an older Arduino, I have set up the jumpers for A4-SDA and A5-SCL per the diagram in the last post. I’ve tried to run the calibrate and heading example sketches from the latest LSM303 release.
On one try I was able to get intermittent readouts from the compass in the serial monitor, but since then, I get nothing after the Arduino reaches the first compass.read() call.
I have a Pololu minIMU v1 which I believe also has an LSM303, and I’ve gotten that to work before with this Arduino.
Everything else with this Zumo/Arduino appears to work fine.
You mentioned you are using an older Arduino, which version of Arduino Uno are you using? If you are having trouble attaching an image, you could try uploading it to a third party site and linking to it.