Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small error #2

Open
uraich opened this issue Aug 23, 2022 · 2 comments
Open

small error #2

uraich opened this issue Aug 23, 2022 · 2 comments

Comments

@uraich
Copy link

uraich commented Aug 23, 2022

Hi,
I know, this is already pretty old , but I wanted to pull your attention to a very small error:
In line 30:
i2c.writeto_mem(30, 0x00, pack('B', 0b111000)) should read: i2c.writeto_mem(30, 0x00, pack('B', 0b1111000)) (0x78 instead of 0x38)
The program works fine nevertheless only that the average is 2 instead of 8.
I have written a complete hcm5883 driver for a course on IoT and had quite a few problems with it. Looking at your code helped me a lot to find a bug I would probably not have found otherwise. Starting from a worrking program makes things so much easier.
Thanks a lot.

@adam-stamand
Copy link

To add to that, it seems like the default pin assignment and documentation is incorrect. At least for the dev board I have (HiLetgo) and for all references I've found online,

SCL is on pin 5 and SDA is on pin4

If anyone experiences issues finding the device on the bus, ensure you've got the correct pins assigned. Thanks to the author for posting this reference code!

@niallp
Copy link

niallp commented Jul 12, 2024

@uraich > Hi, I know, this is already pretty old , but I wanted to pull your attention to a very small error: In line 30: i2c.writeto_mem(30, 0x00, pack('B', 0b111000)) should read: i2c.writeto_mem(30, 0x00, pack('B', 0b1111000)) (0x78 instead of 0x38) The program works fine nevertheless only that the average is 2 instead of 8.

From my read of the datasheet and comments, the value should be 0b1110000 (0x70) not 0x78 (unless you want the output rate at 75 Hz instead of the 15 Hz default from the comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants