HMC6352

From Noisebridge
Jump to navigation Jump to search

Compass chip, using I2C

Quick test using ESP-01 with MicroPython.

>>> from machine import Pin, I2C
>>> i = I2C(scl=Pin(0), sda=Pin(2), freq=100000)
>>> i.writeto(33, 'A')
1
>>> i.readfrom(33, 2)
b'\x07\x9b'
>>> i.readfrom(33, 2)
b'\x07\x9b'
>>> i.writeto(33, 'A')
1
>>> i.readfrom(33, 2)
b'\x06\x82'
>>> i.writeto(33, 'A')
1
>>> i.readfrom(33, 2)
b'\x06\x82'