HMC6352 trouble..

04 May 2013

Hello all,

i have robotics project with HMC6352, but this sensor doesn't work with mbed, i have tried it with arduino, it's perfect.

But with mbed i don't understand, i use the library of Aaron Berk and it doesn't work.

My programming :

#include "mbed.h"
#include "HMC6352.h"

DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
HMC6352 compass(p9, p10);

int main()
{

    pc.printf("\n\rStart compass mode \n\r");
    compass.setOpMode(HMC6352_CONTINUOUS, 1, 20);

    while(1) {

        pc.printf("\n\r En attente \n\r");

       
        pc.printf("\n\r Heading : %4d \n\r", compass.sample());
        
        wait (0.1);

    }
}

I use TeraTerm, any response, the same with HMC6352 example (from library)

So can you help me to understand ? Thanks !

03 May 2013

Please use <<code>> and <</code>> around your code.

Aren't you getting any text whatsoever in teraterm? Then most likely you have no pull-up resistors on p9 and/or p10.

04 May 2013

There's text in tera term but it doesn't work because the compass.sample() return heading : 9735 it's impossible.

I've seen more examples with resistors, I'm going to try it

04 May 2013

I have tried and it does work excellent !!

Thanks a lot, the solution was 2 resistors (10kOhms) for SDA and SCL !

Thanks Erik !